Grouping sets helper functions

There are three helping functions that you can use for queries that use grouping capabilities.

GROUPING, GROUPING_ID, and GROUP_ID are helping functions for GROUPING SETS, CUBE, and ROLLUP. Note that these helping functions cannot be used in a WHERE clause, join condition, inside an aggregate function, or in the definition of a grouping attribute.