Write a SQL query using GROUP BY, INNER JOIN, and ORDER BY.
Use the provided department and employee tables. Return only departments with at least one matching employee, summarize employee counts and salaries, and sort the results by total salary from highest to lowest.
department_name, employee_count, and total_salarytotal_salary descending, with NULL totals last, then department_name ascending| Column | Type | Description |
|---|---|---|
| department_idPK | INT | Unique department identifier |
| department_name | VARCHAR(100) | Department display name |
| Column | Type | Description |
|---|---|---|
| employee_idPK | INT | Unique employee identifier |
| employee_name | VARCHAR(100) | Employee full name |
| department_id | INT | Employee department reference |
| salary | DECIMAL(12,2) | Annual employee salary |