Chapter 4 · Aggregations
13. Count Orders by Status Category
Easy10 XPE-Commerce
Write a single query that returns the total number of orders, the count of completed orders (status = 'delivered'), and the count of problematic orders (status IN ('cancelled', 'returned')).
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.