Introduction
GROUPING SETS
Summary

Instruction

Well done! Let's say we also need to add the general average repair duration to our report. To that end, we can use an empty pair of parentheses:

SELECT
  DateReceived, 
  CustomerId, 
  RepairCenter, 
  AVG(RepairDuration) AS AvgRepairDuration
FROM WarrantyRepair
GROUP BY GROUPING SETS
(
  (CustomerId, RepairCenter),
  (DateReceived),
  ()
)

Exercise

Run the template query. As you can see, a row with a general average was added.