Chapter 4 · Aggregations
11. Top 10 Spending Customers
Easy10 XPE-Commerce
Find the top 10 customers by total spending. Return their first name, last name, and total amount spent (sum of order total_amount), sorted by total spent descending. Only include non-cancelled orders.
Tables
- PKidINT
- first_nameTEXT
- last_nameTEXT
- emailTEXT
- phoneTEXT
- cityTEXT
- stateTEXT
- countryTEXT
- created_atTIMESTAMP
- PKidINT
- FKcustomer_id→ customers.idINT
- order_dateTEXT
- statusTEXT
- total_amountREAL
Need help?
Ask Sol
AI tutor — looks at your current query and nudges you, without spoiling the answer.
Solution
Try the hints first — solving it yourself is what makes it stick.