- Published on
Leetcode - 177. Nth Highest Salary
- Authors
- Name
- Indo Yoon
Table of Contents
문제
[Loading...
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
LeetCode
](https://leetcode.com/problems/nth-highest-salary/)
정답
CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
BEGIN
DECLARE M INT;
SET M=N-1;
RETURN (
SELECT salary
FROM Employee
GROUP BY salary
ORDER BY salary DESC
LIMIT 1
OFFSET M
);
END