Skip to main content

Find Revenue by Department

MediumPremium

You are given the following tables:

orders table:

order_idcustomer_idorder_dateorder_amountdepartment_id
integerintegerdateintegerinteger

departments table:

department_iddepartment_name
integerstring

customers table:

customer_idfirst_namelast_name
integerstringstring

Order the departments from highest to lowest revenue in the last 12 months. Your output should have the following columns: department_name, total_revenue