Getting everything ready for you…

Loading courses, problems and your progress. This takes just a moment.

0s

SQL practice › Window functions

Salary Rank in Department

Hard · Window functions

For every employee in a department, return name, department name, salary and their rank by salary inside their department (highest = 1). Equal salaries get the same rank and the next rank is skipped (like RANK()).

Hint

RANK() OVER (PARTITION BY … ORDER BY …).

Write your query on this page — it runs against the sample company database in your browser and is checked instantly.

Next problem: Top Earner per Department