掘金团队号上线,助你 Offer 临门! 点击 查看详情
一、题目描述:
二、思路分析:
- 根据薪水排序 逆序
- limit 1 offset 1来找到第二个
- DISTINCT 保证不重复
三、AC 代码:
select
(select DISTINCT salary from Employee order by salary DESC limit 1 offset 1)
as SecondHighestSalary
四、总结:
通过limit 1 offset 1来找到第二个
掘金团队号上线,助你 Offer 临门! 点击 查看详情
select
(select DISTINCT salary from Employee order by salary DESC limit 1 offset 1)
as SecondHighestSalary
通过limit 1 offset 1来找到第二个