Spot the bug SQL
1
-- Average discount per customer across all their orders.
2
-- (orders placed without a coupon store discount = NULL)
3
SELECT customer_id, AVG(discount) AS avg_discount
4
FROM orders
5
GROUP BY customer_id;