Tech Mahindra's workforce analytics team needs to compare active employees within their departments. Write a PostgreSQL query that ranks employees by salary within each department.
employment_status = 'Active'.RANK() to rank salaries from highest to lowest independently within each department. Treat missing salaries as the lowest values.| Column | Type | Description |
|---|---|---|
| department_idPK | INT | Unique department identifier |
| department_name | VARCHAR(100) | Department name |
| Column | Type | Description |
|---|---|---|
| employee_idPK | INT | Unique employee identifier |
| department_id | INT | Employee's department identifier |
| employee_name | VARCHAR(100) | Employee's full name |
| salary | INT | Annual salary |
| employment_status | VARCHAR(20) | Current employment status |