CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
BEGIN
set n := n -1;
RETURN (
# Write your MySQL query statement below.
select salary
from employee
group by salary
order by salary desc
limit n, 1
);
END
这里要注意,要将n : n-1
因为limit后不能出现‘-’号
本题要求同薪同名且总排名连续,所以只要将薪水一样的group就可以了