Microsoft HR wants to ensure that compensation structures reflect leadership hierarchies. Specifically, they want to identify managers who are the highest earners within their own immediate team.
Write an SQL query to find the names of managers whose salary is strictly higher than the salary of all their direct reports.
| employee_id(INTEGER) | employee_name(VARCHAR) | salary(INTEGER) | manager_id(INTEGER) |
|---|---|---|---|
| 1 | Satya | 500000 | null |
| 2 | Amy | 300000 | 1 |
| 3 | Kevin | 250000 | 1 |
| 4 | Brad | 400000 | 2 |
| 5 | Judson | 100000 | 2 |
| 6 | Chris | 450000 | 3 |
| dept_id(INTEGER) | dept_name(VARCHAR) |
|---|---|
| 10 | Engineering |
| 20 | Finance |
| 30 | Sales |
| 40 | Marketing |
| 50 | HR |
| 60 | Legal |
| employee_id(INTEGER) | rating(INTEGER) |
|---|---|
| 1 | 5 |
| 2 | 4 |
| 3 | 3 |
| 4 | 5 |
| 5 | 2 |
| 6 | 4 |
| manager_name(VARCHAR) |
|---|
| Satya |