Accepted solution


  • 0
    L
    CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
    BEGIN
      RETURN (
        select Tb.Salary   from (select distinct Salary from Employee)Tb 
           # distinct Salary to find Nth highest Salary
                    where n-1=( select count(Salary) from
                   (select distinct Salary from Employee) Ta  where 
                               Tb.Salary < Ta.Salary
    )
      );
    END
    

Log in to reply
 

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