What are the manager ids of managers who manage 4 or more employees?
select manager_id from employees group by manager_id having count(employee_id) >= 4
What are their department ids?
select distinct department_id from employees group by department_id, manager_id having count(employee_id) >= 4