The Engineering Roster
The VP of Engineering at Kestrel Labs is running a compensation review with her own team and wants the working list in front of her: her people and what each of them is paid, best paid at the top so the conversation starts at the expensive end.
The employee export will not tell you which of these people are hers, at least not directly. Each row carries a plain number in department_id, and the number-to-team lookup lives in a second table. Settle which number Engineering is first; the employee table is not useful until you have.
departments — one row per team. budget is that team's annual budget in dollars.
| id | name | budget |
|---|---|---|
| 1 | Engineering | 900000 |
| 2 | Sales | 400000 |
| 3 | Marketing | 250000 |
| 4 | Data | 500000 |
employees — one row per person. department_id is the team they sit on, given as the matching id in departments; salary is annual pay in dollars; hire_date is the day they started, written year-month-day; manager_id is the id of the person they report to, and is NULL for anyone who reports to nobody.
| id | name | department_id | salary | hire_date | manager_id |
|---|---|---|---|---|---|
| 1 | Ava Chen | 1 | 145000 | 2021-03-14 | NULL |
| 2 | Ben Ortiz | 1 | 118000 | 2022-06-01 | 1 |
| 3 | Cara Novak | 1 | 121000 | 2023-01-10 | 1 |
| 4 | Deshawn Lee | 2 | 95000 | 2020-09-23 | NULL |
| 5 | Elin Kask | 2 | 88000 | 2022-11-05 | 4 |
| 6 | Farid Amiri | 3 | 76000 | 2023-04-18 | NULL |
| 7 | Grace Kim | 4 | 132000 | 2021-07-30 | NULL |
| 8 | Hugo Silva | 4 | 110000 | 2023-02-14 | 7 |
| 9 | Ines Duarte | 4 | 104000 | 2023-08-01 | 7 |
| 10 | Jonas Weber | 2 | 91000 | 2021-12-19 | 4 |
Both tables already exist in the database — there is nothing to create or load.
Task: Write a query returning two columns, name and salary, one row per employee on the Engineering team, highest salary first. No two Engineering salaries are equal, so that single instruction fixes the order completely.
Example output — shape only, on invented people and pay:
| name | salary |
|---|---|
| Nils Ahlberg | 92000 |
| Mira Solberg | 81500 |
| Otto Brandt | 67000 |
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in