shop_customers (customer_id, name) lists customers and shop_orders (order_id, customer_id, ordered_at, amount) their orders. An order's amount is NULL until it has been priced.
Return every customer — including those who have never ordered — with:
- •
orders — how many orders they placed, priced or not (0 when none) - •
total_spend — the sum of their priced amounts (0 when nothing is priced) - •
avg_order_value — the average amount of their priced orders, rounded to 2 decimal places; NULL when they have no priced order. An unpriced order is left out of the average, not counted as 0.
Columns: customer_id, orders, total_spend, avg_order_value. Sort by customer_id.