【Leetcode SQL】181: 超过经理收入的员工

 

这个题目在写的时候可以使用equal join,也就是将两个relation也就是两个table联系起来。最后输出的时候注意,column名应当为Employee而不是Name,需要再做一下as操作重命名。因此代码如下:

# Write your MySQL query statement below
select a.Name AS 'Employee'
from Employee a,Employee b
where a.ManagerId=b.Id and a.Salary> b.Salary

 

posted @ 2021-10-11 21:05  Geeksongs  阅读(25)  评论(0编辑  收藏  举报

Coded by Geeksongs on Linux

All rights reserved, no one is allowed to pirate or use the document for other purposes.