Skip to main content
All Problems
hard0% acceptance

Assign Customers to Spending Quartiles

Divide customers into four equal-sized spending tiers based on their total order spending. Return customer_id, total_spending, and spending_quartile (1 = lowest, 4 = highest). Sort by total_spending descending.

Schema

🔑idINT
🔗customer_idINT
order_dateTEXT
statusTEXT
total_amountREAL
postgresql

Run your query to see results

Press Ctrl + Enter to execute