CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
BEGIN
RETURN (
# Write your MySQL query statement below.
select
IFNULL(
(select a.salary
from (select
e.salary
, @curRank := @curRank + 1 AS rank
from (select distinct salary from Employee order by salary desc limit N) e, (SELECT @curRank := 0) r) a
where a.rank=N), NULL)
);
END