GROUP BY clause on the managerId column of the Employee table to aggregate the data by managers.COUNT() function to count the number of direct reports for each manager.HAVING clause to filter the results to only include managers with five or more direct reports.Employee table to get the names of the managers.name column from the Employee table where the id matches the managerId from the filtered result.erDiagram
Employee {
int id PK "The unique identifier for an employee"
varchar name "The name of the employee"
varchar department "The department where the employee works"
int managerId "The identifier for the employee's manager"
}
Employee ||--o{ Employee : manages