HashedIn's engineering dashboard needs to identify active employees whose compensation is the second-highest distinct salary in the company. Write a PostgreSQL query that also displays each employee's department when available.
is_active is TRUE and salary is not NULL.employee_id ascending.| Column | Type | Description |
|---|---|---|
| employee_idPK | INTEGER | Unique employee identifier |
| employee_name | VARCHAR(100) | Employee's full name |
| salary | NUMERIC(12,2) | Annual employee salary |
| department_id | INTEGER | Referenced department identifier |
| is_active | BOOLEAN | Whether the employee is currently active |
| Column | Type | Description |
|---|---|---|
| department_idPK | INTEGER | Unique department identifier |
| department_name | VARCHAR(100) | Department name |