Write a SQL query to retrieve data from two tables using an inner join and aggregate the results.
Use the provided departments and employees tables. Return one row for each department with at least one matching employee.
department_name, employee_count, and total_salary.total_salary descending, then department_name ascending.| Column | Type | Description |
|---|---|---|
| department_idPK | INT | Unique department identifier |
| department_name | VARCHAR(100) | Department name |
| Column | Type | Description |
|---|---|---|
| employee_idPK | INT | Unique employee identifier |
| employee_name | VARCHAR(100) | Employee name |
| department_id | INT | Referenced department identifier |
| salary | INT | Employee salary |