← SQL & Databases
#8 most askedVery commonHardWindow functions

Top 3 Salaries in Each Department

🏢 Asked in real interviews
No reports yet. Were you asked this? Be the first to say where.
I was asked this

For each department, return the employees whose salary is among the top 3 distinct salaries in that department: department, employee, salary.

🧪 Practice

Write the query, then press Run tests to compare your rows with the expected result.

SQL
SELECT *
FROM employees;

Output appears here. Press Run or Ctrl/⌘ + Enter.

Try it first. Struggling for a few minutes is how it sticks.