Filter Employees Table by Manager Count

Find managers who manage more than 5 employees.

sql

SELECT manager_id, COUNT(id) AS employee_count FROM employees GROUP BY manager_id HAVING COUNT(id) > 5;

This query groups the "employees" table by the "manager_id" column and uses the HAVING clause to filter for managers associated with more than 5 records.

PromptDB can make mistakes. Please double-check responses.