612ms Solution


  • 0
    F

    CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
    BEGIN
    declare m int;
    declare a int;
    set a = N - 1;
    if N = 0 then set m = NULL;
    elseif N >= 1 then select Salary into m from Employee group by Salary order by Salary desc limit a, 1;
    end if;
    RETURN m;
    END


Log in to reply
 

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