[LeetCode][Database]Second Highest Salary

来源:互联网 发布:如何制作视频短片软件 编辑:程序博客网 时间:2024/05/05 05:11

题目来源:https://leetcode.com/problems/second-highest-salary/

这里写图片描述

For example, given the above Employee table, the second highest salary is 200. If there is no second highest salary, then the query should return null.

即:从给出的工资表中,输出第二高的工资,若没有第二高的(指的是去重后的第二高)则返回null。
意思是低于最高工资的剩下id中的最高工资,所以有:
select max(Salary) from Employee
where Salary < (select max(Salary) from Employee)
难得一次通过了

0 0
原创粉丝点击