181. Employees earning more Than their managersQuestion Editorial Solution submissions total accepted:23223 total submissions:61926 difficulty:easy
The Employee table holds all employees including their managers. Every employee has an ID, and there are also a column for the manager ID.
+----+-------+--------+-----------+
| Id | Name | Salary | ManagerID |
+----+-------+--------+-----------+
| 1 | Joe | 70000 | 3 |
| 2 | Henry | 80000 | 4 | |
3 | Sam | 60000 | NULL |
| 4 | Max | 90000 | NULL |
+----+-------+--------+-----------+
Given The Employee table, write a SQL query that finds out employees who earn more than their. For the above table, Joe was the only employee of who earns more than his manager.
+----------+
| Employee |
+----------+
| Joe |
+----------+
Subscribe to the which companies asked this question
# Write your MySQL query statement below
Select E.name as employee
from employee e, employee E1
where e.manage RId = E1. Id and E.salary > E1. Salary;