Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Tasks
9. Task 4

Instruction

Oh, the most expensive cake is the lemon layer cake. Good to know!

Next, Lisa would like to see each month's revenue. Are you ready to write another query?

Exercise

Select each month for each at least one purchase have been made (name the column month) and the total monthly sales (calculated based on the price and the number of sold cakes). Name the second column revenue. Sort the records by month, in ascending order.

Note: our database contains only data from year 2019.

Here's how the result table should look like:

month revenue
1.0 2352.67
... ...

Stuck? Here's a hint!

Use the EXTRACT() function to select the month from purchase date.

Inside SUM(), multiply the price by the number of purchased cakes to find monthly revenue.

Learn more in this exercise of the SQL Basics course.