Introduction
GROUP BY – Recap
Summary
21. Exercise 1

Instruction

Great! For this quiz, we're going to use a simple table:

DepartmentCost(Department, Year, TotalCost)

It shows the overall cost of running a given department in a given year. The cost is expressed in thousands of dollars.

Exercise

Show the sum of the TotalCost for each Department and Year; the total sum of TotalCost for each Department across all years; and the grand total of TotalCost across all departments and years.

Show the following columns: GroupingId (depending on the Department and Year columns, respectively), Department, Year, and the sum of TotalCost (as Total).