Team size for every manager

MediumMicrosoftself joinaggregation· 20 XP

Microsoft's HR team is reviewing spans of control: how many people report directly to each manager, and what they're paid.

For every employee who has at least one direct report, show their emp_id, job_title, the number of direct reports and the reports' average salary.

Expected output

  • avg_report_salary rounded to a whole number; any row order

Example of the shape (made-up values):

manager_id job_title reports avg_report_salary
9 Manager 5 118300

Hints, the later steps and the answer come with Pro.

Write your query here. Ctrl + Enter submits.