#力扣 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;

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

 

方法二:

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

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

 

修订版:

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

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

 

 

 

上一篇:Mysql训练:第二高的薪水(IFNULL,OFFSET,LIMIT)


下一篇:使用pytorch搞定指针式仪表的读数