SQL实战练习题(2)-求第N高的薪资-leetcode sql 176
问题

正解
drop PROCEDURE if EXISTS getNthHighestSalary;
create PROCEDURE getNthHighestSalary(N int)
begin
SELECT *
FROM employee e
WHERE 4=(
SELECT count(DISTINCT Salary)
FROM employee e2
WHERE e.Salary < e2.Salary
);
end

浙公网安备 33010602011771号