Which statement best describes the GROUPING function?
A.
It is used to form various groups to calculate total and subtotals created using ROLLUP
and CUBE operators.
B.
It is used to identify if the NULL value in an expression is a stored NULL value or created
by ROLLUP or CUBE.
C.
It is used to specify the concatenated group expressions to be used for calculating the
grand totals and subtotals.
D.
It is used to set the order for the groups to be used for calculating the grand totals and
subtotals.
Can anyone explain why B is correct and why the other ones are false?
this topic is a part of GROUPING SETS , in this NULL is used to cause a grand total to be calculated and displayed…
ex common syntax for bank details
select ..
{ group by GROUPING SETS ((PAN CARD, ADHAR CARD),(DRIVING LICENCES),NULL) }
this syntax shows grand total for three different sets…….for all possible values……
GROUPING distinguishes superaggregate rows from regular grouped rows. It returns 1 for superaggregate rows and 0 for others. So, using GROUPING function you can identify if the NULL is stored or created.