Avalara needs a compensation report showing employees who earn the second-highest distinct salary among active employees. Write a PostgreSQL query using a window function and a join to return all employees tied at that salary.
is_active is TRUE and salary is not NULL.employee_id.| Column | Type | Description |
|---|---|---|
| employee_idPK | INT | Unique employee identifier |
| employee_name | VARCHAR(100) | Employee's full name |
| department_id | INT | References departments.department_id |
| salary | NUMERIC(12,2) | Annual employee salary |
| is_active | BOOLEAN | Whether the employee is currently active |
| Column | Type | Description |
|---|---|---|
| department_idPK | INT | Unique department identifier |
| department_name | VARCHAR(100) | Avalara department name |