其他分享
首页 > 其他分享> > #力扣 LeetCode176. 第二高的薪水 @FDDLC

#力扣 LeetCode176. 第二高的薪水 @FDDLC

作者:互联网

题目描述:

https://leetcode-cn.com/problems/second-highest-salary/

 

方法一:

select (select distinct Salary from Employee order by Salary desc limit 1,1) as SecondHighestSalary;

 

方法二:

select max(Salary) as SecondHighestSalary from
(select Salary from Employee where Salary!=(select max(Salary) from Employee)) tmp;

 

修订版:

select max(Salary) SecondHighestSalary
from Employee
where Salary!=(select max(Salary) from Employee);

 

 

 

标签:Salary,max,LeetCode176,力扣,where,SecondHighestSalary,Employee,FDDLC,select
来源: https://blog.csdn.net/liuxc324/article/details/111703265