Spending Tiers
A medium SQL interview practice problem on DataDriven. Write and execute real sql code with instant grading.
- Domain
- SQL
- Difficulty
- medium
- Seniority
- L4
Problem
The loyalty program wants to bucket every customer into a spending tier. Compute each user's total transaction spending and label them 'high' if the total is above 500, 'medium' if it is between 200 and 500 inclusive, and 'low' if it is below 200. Return the user_id and that tier label.
Summary
High rollers, mid-spenders, and the frugal. Everyone gets a tier.
Practice This Problem
Solve this SQL problem with real code execution. DataDriven runs your SQL queries against a real database and grades it automatically.