GROUP_ID assigns a number to each group defined in a GROUP BY clause,
GROUP_ID can be used to easily see duplicated groups in query results.
Example:
select avg(salary), mgr_id, group_id() gid from EMP group by mgr_id;
AVG(SALARY) MGR_ID GID
———————- ———— —–
11000 100 0
12300 101 0
45643 102 0
This example shows no duplicate groups.
Group_id – Oracle SQL Function