A simpler solution:
from Employee e1 join Employee e2
on e1.Id = e2.ManagerId
group by e1.Id
having count(e1.Id) >= 5;
when p_id is null then 'Root'
when id in (select t.p_id from tree as t) then 'Inner'
end as type
order by id;
my CASE solution simpler than this solution
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.