题目描述:
表:Employee
+-------------+---------+
| Column Name | Type |
+-------------+---------+
| id | int |
| name | varchar |
| salary | int |
| managerId | int |
+-------------+---------+
Id是该表的主键。
该表的每一行都表示雇员的ID、姓名、工资和经理的ID。
编写一个SQL查询来查找收入比经理高的员工。
以 任意顺序 返回结果表。
方法一:MySQL语句(使用where)
# Write your MySQL query statement below //方法一:使用where语句
select a.Name as 'Employee' from Employee as a,Employee as b where a.ManagerId = b.Id and a.Salary > b.Salary;
方法二:MySQL语句(使用join)
# Write your MySQL query statement below //方法二:使用join语句
select a.Name as 'Employee' from Employee as a JOIN Employee as b on a.ManagerId = b.Id and a.Salary > b.Salary;