What are the unique ids of those departments where any manager is managing 4 or more employees.
SELECT DISTINCT department_id FROM employees GROUP BY department_id ,  manager_id HAVING COUNT(employee_id)  >= 4
unique ids = SELECT DISTINCT; departments where any manager is managing 4 or more employees = GROUP BY department_id, manager_id HAVING COUNT(employee_id) >= 4;