Instruction
Excellent. Now, you may have noticed that when we wrote:
SELECT full_name, category, AVG(score) AS avg_score FROM contest_score GROUP BY ROLLUP (full_name, category);
we got the following groupings:
- Average by
full_nameandcategory - Average by
full_name - Overall average
In other words, we saw the full_name average, but we didn't see an average for category only. That's because the column order matters in ROLLUP. Let's check that out.
Exercise
Run the template query. Note that the order of columns inside the parentheses of ROLLUP has been reversed.
As you can see, we now have the following groupings:
- Average by
full_nameandcategory - Average by
category - Overall average



