FunctionRacerProblemsRace

Best Paid in Each Department

MediumSQLSQLite

Return the dept, name and salary of the best paid person of every department. When several people share the top salary of a department, return all of them. Rows may come in any order.

Example 1

employees
idnamedeptsalary
1Adaops5000
2Benops5000
3Cyops4000
4Deerisk6000
5Elirisk3000
returns
deptnamesalary
opsAda5000
opsBen5000
riskDee6000

Constraints

Race itor take your time

Write it in your browser, against the clock. The model query, with a note on each piece of it, comes after.

More SQL problems