Great! It’s time to wrap things up.
GROUP BY CUBE () creates all possible grouping combinations with the columns inside its parentheses.
- The order of columns within the parentheses of
CUBE doesn't matter.
- You can use the
GROUPING() function to show if the column is included in the grouping.
- You can leave some columns outside
CUBE. Such columns will always be used for grouping.
- You can use additional pairs of parentheses inside
CUBE to indicate that certain columns should be treated as a single column by the
- You can use
COALESCE() to replace
NULL values with something more meaningful.
How about a short quiz now?