← SQL & Databases
#4 most askedVery commonMediumWindow functions

Highest-Paid Employee in Each Department

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

Tables employees and departments(id, name).

For each department, return department, employee and salary for its highest-paid employee(s). Include ties.

🧪 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.