Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
CUBE
Summary

Instruction

Good! Try a short exercise on your own now.

Exercise

Show the average damage repair costs for all grouping combinations based on the Year and Month columns. Group all rows by Cause. Replace any NULL values in Month with the word 'ALL'.

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

Stuck? Here's a hint!

Use the following template:

SELECT
  GROUPING_ID(x, y, z) AS GroupingId,
  COALESCE(x, 'ALL') AS Month,
  ...
FROM ...
GROUP BY 
  CUBE (x, y),
  z;