181. 超过经理收入的员工
表:Employee
+-------------+---------+
| Column Name | Type |
+-------------+---------+
| id | int |
| name | varchar |
| salary | int |
| managerId | int |
+-------------+---------+
id 是该表的主键(具有唯一值的列)。
该表的每一行都表示雇员的ID、姓名、工资和经理的ID。
编写解决方案,找出收入比经理高的员工。
#sql 1
select name Employee from Employee E,
(select id,salary from Employee) M
where E.managerId=M.id and E.salary>M.salary;
#sql 2
select E.name Employee from Employee E inner join Employee M
on E.salary>M.salary and E.managerId=M.id;
#sql 3
select E.name Employee from Employee E,Employee M where
E.salary>M.salary and E.managerId=M.id;