Loading problem...
Your team is building a compensation analytics endpoint over an Employee table with columns (id, salary).
You must return the second-highest distinct salary in the dataset. The output must be a one-column result named SecondHighestSalary.
Important rules:
Submissions are supported in:
Employee:
| id | salary |
|----|--------|
| 1 | 100 |
| 2 | 200 |
| 3 | 300 |[{"SecondHighestSalary":200}]Distinct salaries are [300, 200, 100], so the second-highest value is 200.
Employee:
| id | salary |
|----|--------|
| 1 | 500 |
| 2 | 500 |[{"SecondHighestSalary":null}]There is only one distinct salary value, so no second-highest value exists.
Employee:
| id | salary |
|----|--------|
| 1 | -10 |
| 2 | -30 |
| 3 | -10 |
| 4 | -20 |[{"SecondHighestSalary":-20}]Distinct salaries are [-10, -20, -30] in descending order. The second value is -20.
Constraints