Skip to main content
All Problems
hard0% acceptance

Rank Doctors by Salary Within Department

Rank doctors by salary within each department. Return the department_id, first name, last name, salary, and the rank (1 = highest salary). Use RANK().

Schema

🔑idINT
first_nameTEXT
last_nameTEXT
specialtyTEXT
🔗department_idINT
emailTEXT
phoneTEXT
hire_dateTEXT
salaryREAL
postgresql

Run your query to see results

Press Ctrl + Enter to execute