Three Highest Salaries by Department
HR is preparing a top-earner report for department heads: in every department find the employees whose salary is among the three highest distinct salaries of that department. Output the department name, employee name, and salary; sort by department, then by salary descending.
Expected output sample
This is what a correct answer looks like — its row count is its own, it doesn't have to match the schema tables.
| name | salary | department_name |
|---|---|---|
| Alice | 95000 | Engineering |
| Bob | 90000 | Engineering |
| Eve | 80000 | Engineering |
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign in