Mission M24 · SQL · 20 min
Average order value by channel
Request from your manager
The e-commerce manager asks: "Do online shoppers spend more per order than in-store shoppers? Give me the 2025 average order value for Online."
Data
Download the practice file(s):
Steps
- Join order_items to orders on order_id.
- Filter to 2025 orders.
- GROUP BY o.channel.
- Compute SUM(net sales) / COUNT(DISTINCT o.order_id). Use COUNT(DISTINCT) because one order has several lines.
- Compare both channels, then read the Online row.
Check your answer
What was the 2025 average order value (AOV) for the Online channel?
Show solution
Online AOV in 2025 was $25.41 versus $25.80 in-store — online shoppers spend about the same, slightly less.
SELECT o.channel,
ROUND(SUM(oi.quantity * oi.unit_price * (1 - oi.discount))
/ COUNT(DISTINCT o.order_id), 2) AS aov
FROM order_items oi
JOIN orders o ON o.order_id = oi.order_id
WHERE o.order_date BETWEEN '2025-01-01' AND '2025-12-31'
AND o.channel = 'Online'
GROUP BY o.channel;Answer: 25.41 $