Instruction
Good! There is one more interesting modification of CUBE worth mentioning. Take a look:
SELECT location, gender, risk, AVG(age) AS avg_age FROM vaccine_administration GROUP BY CUBE ((location, gender), risk);
Inside CUBE's parentheses, we put location and gender in another pair of parentheses! This means that location and gender will be treated as a single column – either both or neither of them will be used for grouping:
GROUP BY CUBE((location, gender), risk) = GROUP BY location, gender, risk + GROUP BY location, gender + GROUP BY risk + GROUP BY ()
Exercise
Run the template query. Note that each row is grouped by either location and gender together or by neither of these columns.



