Customer Spend Tiers
Divide customers into three tiers by total spend: tier 1 holds the top third of spenders, tier 3 the lowest third. Return customer_id, total_spent and tier ordered by total_spent descending.
Table schema
Orders(id INT PRIMARY KEY, customer_id INT, amount INT)Sample data
id | customer_id | amount
1 | 1 | 60
2 | 2 | 50
3 | 3 | 40
4 | 4 | 30
5 | 5 | 20
6 | 6 | 10
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.