Second Highest Salary
Programming Interview
Easy
5 views
Problem Description
Table: Employees(emp_id, salary). Return the second highest distinct salary. If it does not exist, return NULL.
Input Format
SQL tables are described in the question.
Output Format
Write the SQL query.
Official Solution
SELECT MAX(salary) AS second_highest
FROM Employees
WHERE salary < (SELECT MAX(salary) FROM Employees);
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!