Your question is Top Paid Per Department. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
DaDa's HR analytics team wants a department-level compensation report. Write a SQL query to find the top 3 highest-paid employees in each department.
employee_id in ascending order so the result is deterministic.| Column | Type | Description |
|---|---|---|
| department_idPK | INT | Primary key for the department |
| department_name | VARCHAR(100) | Department name |
| Column | Type | Description |
|---|---|---|
| employee_idPK | INT | Primary key for the employee |
| employee_name | VARCHAR(100) | Employee full name |
| department_id | INT | Foreign key to departments.department_id |
| salary | NUMERIC(12,2) | Annual salary |