Instruction
Nice! If you need even more fine-grained control over the grouping combinations, you can also use multiple ROLLUPs:
SELECT full_name, category, week, AVG(score) AS avg_score FROM contest_score GROUP BY ROLLUP(full_name, category), ROLLUP(week);
The query above will create even more combinations than
ROLLUP(full_name, category, week)because the grouping options of
ROLLUP(full_name, category) and the grouping options of
ROLLUP(week) are combined together. Take a look at the comparison:

Exercise
Run the template query, to see how multiple ROLLUPs work.



