Chapter 5 · JOINs
14. Customer Order Summary
Medium20 XPE-Commerce
Create a customer-level summary showing each customer's name, total number of orders, and total amount spent. Include customers who have not placed any orders (show 0 for counts and amounts). Sort by total spent descending.
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.