Report the name of every manager who has at least five employees directly referencing that manager’s id. Count direct reports across all departments, without including indirect descendants. Rows may appear in any order.
### Problem
Report the name of every manager who has at least five employees directly referencing that manager’s id. Count direct reports across all departments, without including indirect descendants. Rows may appear in any order.
### Tables
Table: `Employee`
```text
+-------------+---------+
| Column Name | Type |
+-------------+---------+
| id | int |
| name | varchar |
| department | varchar |
| managerId | int |
+-------------+---------+
id is the primary key (column with unique values) for this table.
Each row of this table indicates the name of an employee, their department, and the id of their manager.
If managerId is null, then the employee does not have a manager.
No employee will be the manager of themself.
```
### Example
```text
Employee (id,name,department,managerId):
(10,Ada,A,NULL), (11,Bo,A,10), (12,Cam,A,10), (13,Dee,B,10), (14,Eli,B,10), (15,Fox,B,10)
Output (name): (Ada)
```
### What a Strong Answer Covers
- Count only employees whose manager field points directly to each manager.
- Apply the threshold across departments and keep a row for every qualifying manager.
- Return the requested name even when more than one manager shares it.
### Follow-up Questions
- How would you count reports separately for each department?
- How would the output change if indirect reports also counted?
Overview: Report the name of every manager who has at least five employees directly referencing that manager’s id. Count direct reports across all departments, without including indirect descendants. Rows may appear in any order.
Report the name of every manager who has at least five employees directly referencing that manager’s id. Count direct reports across all departments, without including indirect descendants. Rows may appear in any order.
Tables
Table: Employee
+-------------+---------+
| Column Name | Type |
+-------------+---------+
| id | int |
| name | varchar |
| department | varchar |
| managerId | int |
+-------------+---------+
id is the primary key (column with unique values) for this table.
Each row of this table indicates the name of an employee, their department, and the id of their manager.
If managerId is null, then the employee does not have a manager.
No employee will be the manager of themself.