yokostan / Leetcode-Solutions

Doing exercise on Leetcode. Carry on!
0 stars 3 forks source link

Leetcode #176. Second Highest Salary #208

Open yokostan opened 5 years ago

yokostan commented 5 years ago
# Write your MySQL query statement below
SELECT max(Salary) as SecondHighestSalary
FROM Employee
WHERE Salary < (
    SELECT max(Salary)
    FROM Employee
)

LIMIT 1 version does not handle null case, while max() handles.