当前位置:Gxlcms >
数据库问题 >
[LeetCode][SQL]Nth Highest Salary
[LeetCode][SQL]Nth Highest Salary
时间:2021-07-01 10:21:17
帮助过:3人阅读
#
drop function getNthHighestSalary$$
2 CREATE FUNCTION getNthHighestSalary(N
INT)
RETURNS INT
3 BEGIN
4 DECLARE M
INT;
5 SET M
= N
- 1;
6 RETURN (
7 select distinct Salary
from Employee
order by Salary
desc limit M,
1
8 );
9 END
[LeetCode][SQL]Nth Highest Salary
标签: