SQL interview question: Salary Bands With CASE WHEN
Classify Employees by Salary Tier
Compensation wants to categorize every employee into salary bands for a benefits report.
Use CASE WHEN to classify each employee: • salary >= 150000 → 'Executive' • salary >= 100000 → 'Senior' • salary >= 70000 → 'Mid-Level' • Below 70000 → 'Junior'
Return first_name, salary, and tier. Order by salary descending.
Skills: CASE WHEN for conditional logic
Tables
employees 37 rows
- id integer PK
- first_name text
- last_name text
- email text
- department_id integer → departments
- salary integer
- hire_date text
- manager_id integer → employees
- title text
| id | first_name | last_name | department_id | salary | hire_date | manager_id | title | |
|---|---|---|---|---|---|---|---|---|
| 1 | Alice | Chen | [email protected] | 1 | 250000 | 2015-01-15 | NULL | CEO |
| 2 | Robert | Martinez | [email protected] | 2 | 180000 | 2016-03-20 | NULL | CEO |
| 3 | Sarah | Johnson | [email protected] | 1 | 150000 | 2017-06-10 | 1 | VP Engineering |