181. Employees Earning More Than Their Managers
原题链接:https://leetcode.com/problems/employees-earning-more-than-their-managers/description/
还是一道数据库题目。我的实现如下:
# Write your MySQL query statement below
select e1.Name as Employee from Employee e1
left join Employee e2 on e1.ManagerId = e2.Id
where e1.Salary > e2.Salary;
官方解答:
- 不用连接查询,直接查询两张表,效率要差一点;
- 就是我上面写的连接查询啦;