Written one
select a.name
from Employee a
where a.id = (
select b.managerId
from Employee b
where a.id = b.managerId
group by b.managerId
having COUNT(*) >= 5
);
Writing method 2, build a temporary table tmp
select a.name
from Employee as a
join (
select managerId
from Employee
group by managerId
having COUNT(*) >= 5
) as tmp
on a.id = tmp.managerId;