Munich Reinsurance America needs a workforce report identifying employees whose salary is at rank 2 within their department. Write a PostgreSQL query that joins employee records to department names and ranks salaries independently for each department.
RANK() partitioned by department, ordering salaries from highest to lowest.| 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 | Referenced department identifier |
| salary | NUMERIC(12,2) | Annual salary in US dollars |