25. Low-Engagement Customers

Easy

orders(order_id, customer_id, total_amount, ordered_at)

For 2026, return the customers who placed fewer than 3 orders or spent less than 500 in total. Either condition alone is enough.

Return customer_id, order_count and total_spend, ordered by customer_id.

Because it is OR rather than AND, a customer with many orders but a small basket qualifies, and so does a big spender with only two orders.

Tables

orders

order_id  customer_id  total_amount  ordered_at
--------  -----------  ------------  ----------
1         10           100.00        2026-01-05
2         10           100.00        2026-02-05
3         10           100.00        2026-03-05
4         10           100.00        2026-04-05
5         11           900.00        2026-01-05
6         11           900.00        2026-02-05
7         12           600.00        2026-01-05
8         12           600.00        2026-02-05
... 2 more row(s)

Expected result

customer_id  order_count  total_spend
-----------  -----------  -----------
10           4            400.00
11           2            1800.00

Sign in to write and run your own code.

Write one SELECT query