Chapter 6 · Subqueries
14. Customers Spending Above Average
Medium20 XPE-Commerce
Find customers whose total spending exceeds the average total spending across all customers. Return customer_id, total_spending, and the overall average spending. Sort by total_spending descending.
Tables
- 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.