GROUP BY ROLLUP & CUBE — Concept Check
Questions on GROUP BY ROLLUP & CUBE. ROLLUP and CUBE are extensions to GROUP BY that generate subtotals and grand totals for hierarchical or multi-dimensional data.
Questions in this quiz
7 questions on GROUP BY ROLLUP & CUBE — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A report requires subtotals by city and product category, followed by a grand total. Which SQL clause should you use?
- AGROUP BY (city, product_category)
- BGROUP BY CUBE (city, product_category)
- CGROUP BY ROLLUP (product_category, city)
- DGROUP BY ROLLUP (city, product_category)
2.You need to analyze sales data for all combinations of region and product. Which SQL clause is appropriate?
- AGROUP BY CUBE (product, region)
- BGROUP BY ROLLUP (region, product)
- CGROUP BY CUBE (region, product)
- DGROUP BY (region, product)
3.A query using ROLLUP produces unexpected totals. What might be the issue?
- AMissing GROUP BY clause
- BIncorrect column order in ROLLUP
- CUsing CUBE instead of ROLLUP
- DIncorrect SUM function usage
4.After running a CUBE query, you notice missing combinations of subtotals. What could be wrong?
- AThe order of columns in CUBE is incorrect
- BThe database doesn't support CUBE
- CThe query is missing columns in GROUP BY
- DCUBE only generates hierarchical subtotals
5.Which statement about ROLLUP is correct?
- AROLLUP generates subtotals in a defined hierarchy
- BROLLUP generates all possible combinations of subtotals
- CThe column order in ROLLUP doesn't matter
- DROLLUP is not supported in SQL:1999
6.You run a CUBE query but get an error about unsupported syntax. What might be the issue?
- AThe database version doesn't support CUBE
- BMissing GROUP BY clause
- CIncorrect column order in CUBE
- DUsing ROLLUP instead of CUBE
7.Which SQL extension is used to generate all possible combinations of subtotals for multi-dimensional analysis?
- AORDER BY
- BROLLUP
- CGROUP BY
- DCUBE