Introduction
Quiz
7. Question 5
The End

Instruction

Well done! We have one more question for you.

Exercise

Find the average fuel cost for the following grouping combinations:

  1. Year, Month, and Day
  2. Year and Month
  3. Year
  4. Carsize and TripType
  5. Country

Assume a fuel price of $0.98 per liter. Show the following columns in the query result: Year, Month, Day, CarSize, TripType, Country, and AvgFuelCost.

Stuck? Here's a hint!

Use GROUP BY GROUPING SETS with a ROLLUP inside:

GROUP BY GROUPING SETS
(
  ROLLUP (A, B, C),
  (D, E),
  (F)
)