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

问题

image

正解

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
posted @ 2022-01-11 22:21  UsingStuding  阅读(53)  评论(0)    收藏  举报