LeetCode 177 Nth-Highest Salary mysql,取第n条数据,limit子句 难度:1

https://leetcode.com/problems/nth-highest-salary/

ATTENTION:limit 子句只能接受int常量,不能接受运算式

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

  

原文地址:https://www.cnblogs.com/xuesu/p/4760612.html