LeetCode刷题实战177:第N高的薪水
Write a SQL query to get the nth highest salary from the
Employee
table.
题意
解题
CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
BEGIN
set n = n-1;
RETURN (
# Write your MySQL query statement below.
select distinct Salary
from Employee order by Salary desc
limit 1 offset n
);
END
评论