Total each customer’s orders
Return customer and SUM(total) AS total, ordered by customer.
Your queryQuery investigation
Explore the fictional database
products id | name | stock 1 | Notebook | 5 2 | Lamp | 2 3 | Bag | 0 orders id | customer | total 1 | Asha | 20 2 | Ben | 35 3 | Asha | 80
Read-only SELECT queries. Columns and row order should match the task.
Investigation result5 min · no timer
Show solution and explanation
Return customer and SUM(total) AS total, ordered by customer. Use WHERE to filter, ORDER BY to sort, and GROUP BY with SUM to aggregate.
SELECT customer, SUM(total) AS total FROM orders GROUP BY customer ORDER BY customer;