Save up to $499! Grab all Python courses for $49 or all online courses we’ve ever launched for only $169. Only Feb 11-16. Happy Valentine's!
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.