Medium
INNER JOIN

Revenue Per Customer

Calculate total revenue (sum of total_amount) per customer, showing customer name and total revenue, sorted by revenue descending. Return columns: customer_name, total_revenue. Order results by: total_revenue DESC.

Preparing the interactive SQL workspace...

Challenge overview

What you will practice

Calculate total revenue (sum of total_amount) per customer, showing customer name and total revenue, sorted by revenue descending. Return columns: customer_name, total_revenue. Order results by: total_revenue DESC.

Difficulty
Intermediate
SQL concept
INNER JOIN

Public schema and sample data

customers

id INTEGERname TEXTemail TEXTcountry TEXTjoined_date TEXT
1Acme Corpacme@corp.comUSA2020-01-15
2TechStart Ltdts@techstart.ioUK2020-03-22
3DataFlow Incinfo@dataflow.comUSA2021-06-10

products

id INTEGERname TEXTcategory TEXTprice REALstock INTEGER
1Analytics DashboardSoftware299999
2Data WarehouseInfrastructure149950
3ML PipelineSoftware799999

orders

id INTEGERcustomer_id INTEGERorder_date TEXTtotal_amount REALstatus TEXT
112024-01-102697completed
222024-01-15799completed
312024-02-011499completed

order_items

id INTEGERorder_id INTEGERproduct_id INTEGERquantity INTEGERunit_price REAL
1113299
214899
3231799