177. 第N高的薪水

CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
BEGIN
  SET N = N - 1;
  RETURN (
      # Write your MySQL query statement below.
      SELECT DISTINCT Salary
      FROM Employee
      ORDER BY Salary DESC
      LIMIT N, 1
  );
END
posted @ 2021-08-11 11:32  Dazzling!  阅读(8)  评论(0编辑  收藏  举报