Skip to main content
All Questions

Find Revenue by Department

Medium
Unlock detailed company stats for this questionUpgrade

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 over the most recent 12 months in the data: December 1, 2022 through November 30, 2023. Your output should have the following columns: department_name, total_revenue