Kickstart 2020 with new opportunities! - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Reports with revenue in categories
Revenue in time periods for selected categories
Summary

Instruction

Good job! Let's try another exercise before we move on.

Exercise

For each month of 2017, calculate the total revenue, and the revenue for the 'Dairy Products' and 'Seafood' categories. Show the following columns: revenue_month, total_revenue, dairy_revenue, and seafood_revenue. Use 0.0 for the ELSE case of CASE WHEN. Order the results by month.

Stuck? Here's a hint!

Group the results by EXTRACT(month FROM order_date).

Calculate the dairy_revenue column as:

SUM(CASE
  WHEN c.category_name = 'Dairy Products'
    THEN oi.amount
  ELSE 0.0
END) AS dairy_revenue