Loading...

Spending Tiers

A medium SQL interview practice problem on DataDriven. Write and execute real sql code with instant grading.

Domain
SQL
Difficulty
medium

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.

Practice This Problem

Solve this SQL problem with real code execution. DataDriven runs your SQL queries against a live PostgreSQL database and grades it instantly.