HR teams at Meta need to evaluate management spans and team demographics. For this task, we consider a manager to be any employee who has at least one other employee reporting to them.
Write an SQL query to report the ids and the names of all managers, the number of employees who report directly to them, and the average age of the reports rounded to the nearest integer.
| employee_id(INTEGER) | name(VARCHAR) | reports_to(INTEGER) | age(INTEGER) |
|---|---|---|---|
| 9 | Hercy | null | 43 |
| 6 | Alice | 9 | 41 |
| 4 | Bob | 9 | 36 |
| 2 | Winston | null | 37 |
| employee_id(INTEGER) | name(VARCHAR) | reports_count(INTEGER) | average_age(INTEGER) |
|---|---|---|---|
| 9 | Hercy | 2 | 39 |