Count Salary Categories
Preview mode. Log in to edit, run, submit, and save progress.
Count Salary Categories
You are given an Accounts table containing account IDs and their income. Classify each account into one of three salary categories: - 'Low Salary': income strictly less than 20000 - 'Average Salary': income between 20000 and 50000 inclusive - 'High Salary': income strictly greater than 50000 Write a SQL query to report the number of accounts in each category. If a category has no accounts, report 0. Return all three categories in the result - even if their count is zero.
Examples
Account 2 earns 12747 → Low Salary. Accounts 3, 6, 8 earn above 50000 → High Salary. No account falls in Average Salary range.
Approach hint
Start with a simple approach, explain the trade-off, then move toward a cleaner or more scalable solution.
Common mistake
Skipping assumptions, edge cases, or trade-offs can make an otherwise good answer feel incomplete.