本文主要是介绍力扣SQL50 至少有5名直接下属的经理 子查询 join 虚拟表,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Problem: 570. 至少有5名直接下属的经理
👨🏫 参考题解
🍻子查询
select name
from Employee
where id in(select managerId from Employee group by managerId having managerId != 'null' and count(*) >= 5);
🍻 join 虚拟表
select Employee.Name as Name
from (select ManagerId as Idfrom Employeegroup by ManagerIdhaving count(Id) >= 5
) as Manager join Employee
on Manager.Id = Employee.Id
这篇关于力扣SQL50 至少有5名直接下属的经理 子查询 join 虚拟表的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!