Last Updated: May 12, 2026
For this exercise, we will work with below data:
Write a query using ROLLUP on users.country that returns the user count per country plus a grand total row. Order by country with NULLs last.
Write a query using GROUPING SETS that returns subscription counts by plan alone and a grand total. Use the subscriptions table. Order by plan with NULLs last.