Introduction
CUBE
Summary

Instruction

Well done! You know the drill; it’s your turn now.

Exercise

Show the average wildfire duration for all grouping combinations based on the Year and Month columns. Also, group each row by Cause.

Show the following columns in the query result: GroupingId (depending on the Year, Month, and Cause), Year, Month, Cause, and AvgDuration.

Stuck? Here's a hint!

Use the following template:

SELECT
  GROUPING_ID(x, y, z) AS GroupingId,
  ...
FROM ...
GROUP BY 
  CUBE (x, y), 
  z