GROUP_ID

GROUP_ID is an Oracle SQL analytic function that allows you to identify duplicate rows within a set of rows, based on specified partition criteria. It assigns a unique group number for each set of duplicates in a result set.

Example

SELECT GROUP_ID, COUNT(*)
FROM employees
GROUP BY GROUP_ID;

Output

GROUP_ID | COUNT(*)
---------|---------
1 | 10
2 | 15
3 | 25

Explanation

The code example performs a query on the “employees” table, grouping the data by the ‘GROUP_ID’ field. The output displays the count of employees in each group. It shows the ‘GROUP_ID’ and the respective count of employees in that group.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.