Kickstart 2020 with new opportunities! - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
GROUPING SETS
Summary

Instruction

Great! Now it's your turn to write a similar query.

Try this exercise!

Exercise

Find the average principal amounts for the following two grouping combinations:

  1. year and quarter
  2. country

Show the following columns in the query result: year, quarter, country, and avg_principal.

Stuck? Here's a hint!

Use this template to help you:

SELECT
  A,
  NULL AS B,
  ...
FROM X
GROUP BY A
UNION ALL
SELECT
  NULL AS A,
  B,
  ...
FROM X
GROUP BY B