Wednesday, September 27, 2017

176. Second Highest Salary

https://leetcode.com/problems/second-highest-salary/description/
select max(Salary) as SecondHighestSalary
from Employee
where Salary < (select max(Salary) from Employee)

select (
  select distinct Salary from Employee order by Salary Desc limit 1 offset 1
) as SecondHighestSalary

No comments:

Post a Comment