Nth highest salary


  • 0
    A

    CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
    BEGIN
    DECLARE i INTEGER;
    DECLARE output INTEGER;
    SET i = N - 1;
    SELECT DISTINCT Salary FROM Employee ORDER BY Salary DESC LIMIT 1 OFFSET i INTO output;
    RETURN output;
    END


Log in to reply
 

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