代码:
# Write your MySQL query statement below
select view.employee_id,e.name,view.reports_count,view.average_age
from(
select
reports_to as employee_id,
count(employee_id) as reports_count,
round(avg(age),0) as average_age
from Employees
group by reports_to) view
left join Employees e
on view.employee_id = e.employee_id
where view.employee_id is not null
order by employee_id