Pay by department
MediumMicrosoftgroup byhavingmin and max· 20 XP
Microsoft's HR team is reviewing pay fairness. They want headcount, average salary and the spread of salaries in each larger department.
For each dept_id with at least 10 employees, show the headcount, the average salary and the salary range (highest minus lowest).
Expected output
avg_salaryrounded to a whole number; any row order
Example of the shape (made-up values):
| dept_id | headcount | avg_salary | salary_range |
|---|---|---|---|
| 2 | 18 | 141500 | 165000 |
Hints, the later questions and the answer come with Pro.
Write your query here. Ctrl + Enter submits.