417. Salary Bands per Department

Medium Finance Compensation Analytics
Query Rules
  • The query columns and order must match the expected result schema.
  • NULL values should be handled appropriately where applicable.
  • The grader compares output values and sorting order to evaluate.

Schema Browser

Click a table's header to toggle expand/collapse.
locations
3 cols
departments
3 cols
employees
6 cols
orders
6 cols

Reference Solution

Expected SQL
SELECT dept_id, CASE WHEN salary < 75000 THEN 'Under 75k' WHEN salary < 125000 THEN '75k-125k' WHEN salary < 175000 THEN '125k-175k' ELSE 'Over 175k' END AS salary_band, COUNT(*) AS employee_count FROM employees GROUP BY dept_id, salary_band ORDER BY dept_id, salary_band;
SQL Editor
Ctrl+Enter to run
Console Output

Console Terminal

Write your query and click "Run Query" (Ctrl + Enter) to see results and testcase validation.