Simple and easy to understand solution
\nCREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT\nBEGIN\nSET N = N-1;\n  RETURN (\n      SELECT DISTINCT Salary\n      FROM EMPLOYEE\n      ORDER BY Sal
```\nCREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT\nBEGIN\nSET N = N-1;\n  RETURN (\n      SELECT DISTINCT Salary\n      FROM EMPLOYEE\n      ORDER BY Salary Desc\n      LIMIT 1 OFFSET N\n      \n  );\nEND\n```
['MySQL']