MySQL | Faster than 79.80% | Elegant solution
\nCREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT\nBEGIN\n    DECLARE total INT;\n    SET total = N - 1;\n    RETURN (\n        SELECT IFNULL(\n         
```\nCREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT\nBEGIN\n    DECLARE total INT;\n    SET total = N - 1;\n    RETURN (\n        SELECT IFNULL(\n            (\n                SELECT DISTINCT salary FROM Employee \n                ORDER BY salary DESC \n                LIMIT 1 \n                OFFSET total\n            ), \n            NULL\n        )\n    );\nEND\n```\n\n![image](https://assets.leetcode.com/users/images/5025a67a-aa61-4aec-b74f-9c6ebc0dbb58_1648542410.3723059.png)\n
['Ordered Set']