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;

官方解答:

  1. 不用连接查询,直接查询两张表,效率要差一点;
  2. 就是我上面写的连接查询啦;
posted @ 2018-03-22 11:00  optor  阅读(135)  评论(0编辑  收藏  举报