Introduction
GROUPING SETS
Summary

Instruction

How about trying this exercise?

Exercise

Show the average interest amounts for the following grouping sets:

  1. ROLLUP by Year and Quarter
  2. Country

Show the following columns in the query result: GroupingId (depending on Year, Quarter, and Country respectively), Year, Quarter, Country, and AvgInterest.

Stuck? Here's a hint!

In the GROUP BY clause, use:

GROUPING SETS
(
  ROLLUP (Year, Quarter),
  (Country)
)