Oracle SQL: Aggregate Functions :Group_IdThe GROUP_ID function is used to assign a number to each group that results from a SELECT query clause with a GROUP BY clause.
It’s used to identify any duplicate groups in your output, and works with queries with aggregate functions.
For each unique group that is returned, GROUP_ID will return 0. If a duplicate is found, a value >0 will be returned.
SELECT SUM(sal), deptno, bonus, GROUP_ID()
WHERE bonus > 100
GROUP BY deptno
ROLLUP (deptno, bonus)
HAVING GROUP_ID() < 1;