Save up to $499! Grab all Python courses for $49 or all online courses we’ve ever launched for only $169. Only Feb 11-16. Happy Valentine's!
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)
)