4th place by salary (DENSE_RANK): departments 9–14, all
Instructions
Consider all employees, including those who were fired. Within each department, rank them by salary descending using DENSE_RANK(): equal salaries get the same place, the next place is not skipped. Output the employees of the departments with department_id from 9 to 14 inclusive who took exactly 4th place; if the department has no such place (for example, because of equal salaries above), the department is not in the result, and for equal salaries all such employees are output. Columns: department (the department name), name (the employee's name), salary. Row order does not matter.
Hints
Each next one is more detailed and costs more
Query
Result
Click Run to see the query result, or Check to submit your solution.
Dataset schema
Table relationships
- N:1Many-to-one
employees.→department_id departments.id - N:1Many-to-one
employees.→manager_id employees.id - N:1Many-to-one
departments.→parent_id departments.id - N:1Many-to-one
salary_history.→employee_id employees.id
Table data
Select a table in the diagram or list to view its rows.