Leetcode: Nth Highest Salary, MySQL
February 20, 2020•60 words
Status: Accepted
14 / 14 test cases passed.
Runtime: 484 ms, faster than 48.85% of MySQL online submissions
Memory Usage: 0B, less than 100.00% of MySQL online submissions
CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
BEGIN
SET N = N - 1;
RETURN (
SELECT DISTINCT Salary
FROM Employee
ORDER BY Salary DESC
LIMIT 1 OFFSET N
);
END
...
Read post