第N高薪水

描述
CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
BEGIN
declare M INT;
set M = N-1;
  RETURN (
      select e.Salary 
      from(select Salary from Employee
          union select null as Salary) as e
      order by Salary desc
      limit M,1
  );
END

你可能感兴趣的:(第N高薪水)