Back to questions

Well Paid Employees [FAANG SQL Interview Question]


Companies often perform salary analyses to ensure fair compensation practices. One useful analysis is to check if there are any employees earning more than their direct managers.

As a HR Analyst, you're asked to identify all employees who earn more than their direct managers. The result should include the employee's ID and name.


employee_idintegerThe unique ID of the employee.
namestringThe name of the employee.
salaryintegerThe salary of the employee.
department_idintegerThe department ID of the employee.
manager_idintegerThe manager ID of the employee.

Example Input:

1Emma Thompson380016
2Daniel Rodriguez223017
3Olivia Smith700018
4Noah Johnson680029
5Sophia Martinez1750111
6Liam Brown130003NULL
7Ava Garcia125003NULL
8William Davis68002NULL

Example Output:

3Olivia Smith

The output shows that Olivia Smith earns $7,000, surpassing her manager, William David who earns $6,800.

The dataset you are querying against may have different input & output - this is just an example!

PostgreSQL 14