Inc. In wants to identify the highest-paid employees within each department for compensation analysis. Write a PostgreSQL query that ranks employees independently within their departments and returns the top three salaries per department.
employees to departments using department_id.NULL.employee_id.| 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's full name |
| department_id | INT | Department assigned to the employee |
| salary | NUMERIC(10,2) | Annual employee salary |