Your question is SQL Second Largest Salary. 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.
Sopra Steria's people analytics team needs to identify employees earning the second-highest distinct salary among currently active employees. Write a PostgreSQL query that returns every employee tied at that salary, including department information when available.
| Column | Type | Description |
|---|---|---|
| employee_idPK | INT | Unique employee identifier |
| employee_name | VARCHAR(100) | Employee's full name |
| salary | NUMERIC(10,2) | Annual employee salary |
| department_id | INT | Reference to the employee's department |
| is_active | BOOLEAN | Whether the employee is currently active |
| Column | Type | Description |
|---|---|---|
| department_idPK | INT | Unique department identifier |
| department_name | VARCHAR(100) | Department name |