Accepted solution Nth Highest Salary


  • 0
    A
    CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
    BEGIN
      DECLARE num INT;
      SET num = N-1;
      RETURN (
          # Write your MySQL query statement below.
          SELECT DISTINCT Salary
          FROM Employee
          ORDER BY Salary Desc
          LIMIT 1
          OFFSET num
      );
    END
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.