网站建设知识
LeetCode_Mysql_SecondHighestSalary
2025-07-22 09:53  点击:0

176. Second Highest Salary


1. 问题描述:

写一个sql语句从 Employee 表里获取第二高位的工资。

2. 解决思路:

这道题很简单,就当热身了。首先用max找到最高工资;
然后去找小于最高工资里的最高工资就是第二高的工资。

3. sql语句:

select Max(Salary) from Employee where Salary < (select Max(Salary) from Employee)

4. 运行时间:


希望多多交流指正!