Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
GROUP BY – Recap
ROLLUP
Summary

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:

LEAD

Exercise

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