LeetCode-SQL(一)
时间:2021-07-01 10:21:17
帮助过:3人阅读
BEGIN
declare @num INT
select @num=count(distinct Salary) from EMPLOYEE
if(@N<0 or @N>@num)
set @N=0
RETURN (
select min(Salary) from EMPLOYEE where Salary in (
SELECT DISTINCT TOP (@N) Salary FROM EMPLOYEE order by Salary desc)
);
END
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/second-highest-salary
LeetCode-SQL(一)
标签:stat 简单 用户 tco arch 组合 div table employee