Chapter 4 · Aggregations
51. Order Count and Average by Status
Medium20 XPE-Commerce
Finance wants to understand the average order value segmented by order status. For each distinct order status, calculate the average total_amount and the number of orders. Round the average to two decimal places and sort by average 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.