Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Quiz
7. Question 5
The End

Instruction

Well done! We have one more question for you.

Exercise

Find the average fuel cost rounded to two decimal places for the following grouping combinations:

  1. year, month, and day
  2. year and month
  3. year
  4. car_size and trip_type
  5. country

Show also the general average fuel cost.

Assume a fuel price of $0.98 per liter. Show the following columns in the query result: year, month, day, car_size, trip_type, country, and avg_fuel_cost.

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)
)