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.
Tech Mahindra's workforce analytics dashboard needs to identify the second-highest salary in each department. Write a PostgreSQL query that handles employees with missing salary values and does not treat duplicate salaries as different rank positions.
NULL before ranking.| Column | Type | Description |
|---|---|---|
| department_idPK | INT | Unique department identifier |
| department_name | VARCHAR(100) | Name of the department |
| 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 |