Instruction
Great! Of course, GROUPING SETS works with the GROUPING() function too:
SELECT date_received, customer_id, repair_center, AVG(repair_duration) AS avg_repair_duration, GROUPING(date_received) AS D, GROUPING(customer_id) AS C, GROUPING(repair_center) AS R FROM warranty_repair GROUP BY GROUPING SETS ( (customer_id, repair_center), (date_received) )
Exercise
Find the average interest amounts for the following grouping levels:
yearandquartercountry
Show the following columns in the query result: year, quarter, country, avg_interest, Y, Q, and C. The Y, Q, and C columns show if the columns year, quarter, and country were used in the grouping.



