Write a SQL query using window functions such as DENSE_RANK or ROW_NUMBER to find the top three highest-paid employees in each department at UKG.
Use the provided employee and department data. Include ties at the third salary rank and exclude employees without a matching department.
employee_id, employee_name, department_name, salary, and salary_rank.| Column | Type | Description |
|---|---|---|
| department_idPK | INT | Unique department identifier |
| department_name | VARCHAR(100) | Department display name |
| cost_center | VARCHAR(20) | Optional finance cost-center code |
| Column | Type | Description |
|---|---|---|
| employee_idPK | INT | Unique employee identifier |
| employee_name | VARCHAR(100) | Employee full name |
| department_id | INT | Department assigned to the employee |
| salary | NUMERIC(12,2) | Annual base salary |