570. 至少有5名直接下属的经理
select name
from(select e1.name , count(e2.id)as n
from Employee as e1 join Employee as e2 on e2.managerId=e1.id
group by e2.managerId
) t
where n>=5
连接表 计数 加条件
577. 员工奖金
编写解决方案,报告每个奖金 少于 1000
的员工的姓名和奖金数额。
以 任意顺序 返回结果表。
select name , bonus from Employee e left join Bonus b on e.empId = b.empId
where b.bonus<1000 or b.bonus is null
584. 寻找用户推荐人
select name from Customer where referee_id <> 2 or referee_id is null