欢迎光临散文网 会员登陆 & 注册

[Database-Leetcode]176. Second Highest Salary

2021-02-21 08:43 作者:您是打尖儿还是住店呢  | 我要投稿

Write a SQL query to get the second highest salary from the Employee table.

Employee

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


answer

SELECT MAX(Salary) AS SecondHighestSalary FROM Employee

WHERE Salary < (SELECT MAX(Salary) FROM Employee);






[Database-Leetcode]176. Second Highest Salary的评论 (共 条)

分享到微博请遵守国家法律