Which two statements are true about the GROUPING function? (Choose two.)
A.
It is used to find the groups forming the subtotal in a row.
B.
It is used to identify the NULL value in the aggregate functions.
C.
It is used to form the group sets involved in generating the totals and subtotals.
D.
It can only be used with ROLLUP and CUBE operators specified in the GROUP BY clause.
A and B are correct answers.
Correct answers:
B.
It is used to identify the NULL value in the aggregate functions.
D.
It can only be used with ROLLUP and CUBE operators specified in the GROUP BY clause.
GROUPING distinguishes superaggregate rows from regular grouped rows. GROUP BY extensions such as ROLLUP and CUBE produce superaggregate rows where the set of all values is represented by null. Using the GROUPING function, you can distinguish a null representing the set of all values in a superaggregate row from a null in a regular row.
http://docs.oracle.com/cd/B28359_01/server.111/b28286/functions064.htm
Ans is B and D
but this answer is incorrect in Question 9:
In which scenario would you use the ROLLUP operator for expression or columns within a GROUP BY clause?
A. to find the groups forming the subtotal in a row
select grouping(job), sum(sal) from emp group by rollup (job);
For D
Not only CUBE and ROLLUP
Missing GROUPING SETS
SELECT … [GROUPING(dimension_column)…] …
GROUP BY … {CUBE | ROLLUP| GROUPING SETS} (dimension_column)
Correct answer is AD