Top Earner Per Department

Return the highest-paid employee in every department. Where two employees in the same department are tied on salary, return both.

Order the result by department name, then by employee name.

Expected output


department  | employee | salary
------------+----------+----------
Engineering | Alice    | 120000.00
Sales       | Carol    | 91000.25
Sales       | Dan      | 91000.25
Support     | Erin     | 64000.00
PostgreSQL

Press Run to start the SQL engine.

SensAI
Beta
Tap the mic to stop voice mode