🎴 Flashcard Mode
Database Concepts and SQL Fundamentals
Card1 / 20
Mastered0
Review0
QuestionClick to flip
In which sceneria would you use the ROLLUP operator for expresiion or column with in a GROUPBY clause?
AnswerClick to flip back
A
To create grouping for expressions or columns specified within a GROUPBY clause in one direction,from right to left for calculating the subtotals.
💡 Explanation:
ROLLUP creates subtotals in a right-to-left direction through the GROUP BY columns. For example, ROLLUP(A,B,C) creates subtotals for (A,B,C), then (A,B), then (A), then the grand total. This differs from CUBE which creates all possible combinations.