Your question is Second Highest Salary SQL. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
UST Global's employee directory needs a salary review report. Write a PostgreSQL query to find employees with the second-highest distinct salary among active employees and display their department when available.
employment_status is Active and whose salary is not NULL.| Column | Type | Description |
|---|---|---|
| employee_idPK | INT | Unique employee identifier |
| employee_name | VARCHAR(100) | Employee's full name |
| department_id | INT | Assigned department identifier |
| salary | NUMERIC(12,2) | Annual employee salary |
| employment_status | VARCHAR(20) | Employee's current employment status |
| Column | Type | Description |
|---|---|---|
| department_idPK | INT | Unique department identifier |
| department_name | VARCHAR(100) | Department name |
| location | VARCHAR(100) | Primary department location |