30 - 每位经理的下属员工数量
-- 根据reports_to ,获取employee_id,即分组用e1.reports_to,查询用e2.employee_id,e2.name
select
e2.employee_id,e2.name ,count(e1.reports_to) reports_count,round(avg(e1.age),0) average_age
from
Employees e1 left join Employees e2
on
e1.reports_to = e2.employee_id
where
e1.reports_to is not null
group by
e1.reports_to;