181. 超过经理收入的员工(MySQL)(自连接)
程序员文章站
2022-06-10 23:34:44
...
1 题目
2 MySQL
2.1 方法一(A join B on 条件)
select A.Name as Employee
from Employee as A join Employee as B
on A.ManagerId = B.Id
and A.Salary > B.Salary;
2.2 方法二(A, B where 条件)
select A.Name as Employee
from Employee as A, Employee as B
where A.ManagerId = B.Id
and A.Salary > B.Salary;
3 总结
join的两种等价写法
一个表可以和自身进行连接,即自连接