177-N-Highest-Salary
0x0 题目详情
0x1 解题思路
0x2 代码实现
CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
BEGIN
set N=N-1;
if N<0 then
return null;
else
RETURN (
# Write your MySQL query statement below.
select IFNULL((
select distinct(Salary) from Employee
order by Salary desc
limit N,1
),null) as getNthHighestSalary
);
//别忘了end if
end if;
ENDLast updated