Problem
HR wants a summary of compensation by department. Using the employees table, return department, headcount, avg_salary (rounded to 2 decimal places), min_salary, and max_salary for each department, ordered alphabetically.
Schema
employees
| column | type |
|---|
| id | INTEGER |
| name | TEXT |
| department | TEXT |
| salary | INTEGER |
Sample Data
| id | name | department | salary |
|---|
| 1 | Alice | Engineering | 120000 |
| 2 | Bob | Engineering | 100000 |
| 3 | Carol | HR | 65000 |
| 4 | Dave | Marketing | 80000 |
| 5 | Eve | Marketing | 90000 |
Expected Output
| department | headcount | avg_salary | min_salary | max_salary |
|---|
| Engineering | 2 | 110000.00 | 100000 | 120000 |
| HR | 1 | 65000.00 | 65000 | 65000 |
| Marketing | 2 | 85000.00 | 80000 | 90000 |