Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
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
  date_received, 
  customer_id, 
  repair_center, 
  AVG(repair_duration) AS avg_repair_duration
FROM warranty_repair
GROUP BY GROUPING SETS
(
  (customer_id, repair_center),
  (date_received),
  ()
)

Exercise

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