Explain it in 60 seconds
GROUPING SETS, ROLLUP and CUBE
Data Engineering · SQL · Intermediate
What are GROUPING SETS, ROLLUP and CUBE used for?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- They produce several levels of aggregation in one query.
- ROLLUP gives hierarchical subtotals, like year, year-month, grand total.
- CUBE gives all combinations of the listed columns.
- GROUPING SETS lets you list exactly which groupings you want.
- GROUPING() function tells which rows are subtotals.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.