Customer Spend Quartiles
MediumDescription
For the customers who have ordered, show customer_id, full_name, spent (the
sum of total_amount over their orders) and quartile: split the customers, from the biggest
spender down, into 4 groups as equal in size as possible, numbered 1 to 4. When two customers spent
the same, the one with the lower customer_id comes first.
End your query with ORDER BY quartile, spent DESC, customer_id.
Tables
| customers |
|---|
| customer_id (PK) |
| full_name |
| orders |
|---|
| order_id (PK) |
| customer_id (FK) |
| total_amount |