Customer Segmentation with Contact Labels
Problem
**[Asked at multiple Fintech companies]**
Classify customers by account balance:
- **Premium** (> 10 000) → `'phone'`
- **Standard** (1 000–10 000) → `'email'`
- **Basic** (< 1 000) → `'sms'`
Return all customers with `contact_method`, ordered by balance descending.
Use `UNION ALL` — one SELECT per tier.
Tables
Example rows — the live problem includes the full dataset.
customers
| customer_id | name | account_balance |
|---|
Expected output
Your answer should return 6 rows with the columns customer_id, name, account_balance, contact_method.
Starter code (SQL)
SELECT *
FROM customers;Solve this SQL question free
Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock