Employee Earns More Than Manager
Problem
**[Widely asked at FAANG companies]**
Find all employees who earn a **higher salary than their direct manager**.
An employee's manager is identified by the `manager_id` column (which references
another `employee_id` in the same table).
Return `employee_id` and `employee_name`, ordered by `employee_id`.
Tables
Example rows — the live problem includes the full dataset.
employees
| employee_id | employee_name | salary | manager_id |
|---|
Expected output
Your answer should return 1 row with the columns employee_id, employee_name.
Starter code (SQL)
SELECT *
FROM employees;Solve this SQL question free
Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock