No Variable, No Limit X,1, Just one query, 808ms
    CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT\n    BEGIN\n        \n      RETURN (\n          # Write your MySQL query statement below.\n          
        CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT\n    BEGIN\n        \n      RETURN (\n          # Write your MySQL query statement below.\n          \n        \n          SELECT e1.Salary\n          FROM (SELECT DISTINCT Salary FROM Employee) e1\n          WHERE (SELECT COUNT(*) FROM (SELECT DISTINCT Salary FROM Employee) e2 WHERE e2.Salary > e1.Salary) = N - 1      \n          \n          LIMIT 1\n          \n          \n          \n          \n      );\n    END
[]