给定 Employee 表,编写一个 SQL 查询,该查询可以获取收入超过他们经理的员工的姓名。在上面的表格中,Joe 是唯一一个收入超过他的经理的员工。
Solution 1
Select E1.Name as Employee
From Employee as E1, Employee as M2
Where M2.Id=E1.ManagerId And E1.Salary > M2.Salary
Solution 2
SELECT
a.NAME AS Employee
FROM Employee AS a JOIN Employee AS b
ON a.ManagerId = b.Id
AND a.Salary > b.Salary
表A经理的ID=表B员工的ID,且表A的工资大于表B的工资