Your question is SQL Second Highest Salary. Start with the requirements and the one table 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.
S&P Global needs a compensation validation query for employee records used in internal QA reporting. Write a PostgreSQL query to return the second distinct highest salary from the employees table without using analytical or window functions.
second_highest_salary.NULL salaries and return NULL if fewer than two distinct non-NULL salaries exist.RANK, DENSE_RANK, ROW_NUMBER, or other window functions.| Column | Type | Description |
|---|---|---|
| employee_idPK | INT | Unique employee identifier |
| employee_name | VARCHAR(100) | Employee name |
| department | VARCHAR(50) | Organizational department |
| salary | NUMERIC(12,2) | Annual salary |