🔴 MySQL Solution 🔴
Solution\n\nCREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT\nBEGIN\n  RETURN (\n     SELECT distinct salary\n     FROM (\n         SELECT salary, DENSE_R
# Solution\n```\nCREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT\nBEGIN\n  RETURN (\n     SELECT distinct salary\n     FROM (\n         SELECT salary, DENSE_RANK() OVER(ORDER BY salary DESC) as rn\n         FROM Employee\n     ) as sub_select\n     WHERE rn = N\n  );\nEND\n```\nThe **DENSE_RANK()** is a window function that assigns a rank to each row within a partition of a result set. Unlike the **RANK()** function, the **DENSE_RANK()** function returns consecutive rank values. Rows in each partition receive the same ranks if they have the same values.\nIf you find this **solution** and **explanation** helpful, please **upvote** it for others people.
['MySQL']