Nth Maximum Salary (Small and easy)


  • 0
    3
    CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
    BEGIN
    DECLARE i INT;
    SET i=N-1;
      RETURN (
          select Distinct(Salary) from Employee order by Salary DESC LIMIT 1 OFFSET i
          
      );
    END
    

Log in to reply
 

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