[SQL] LeetCode 177. Nth Highest Salary
Write an SQL query to report the nth highest salary from the Employee table. If there is no nth highest salary, the query should report null.
The query result format is in the following example.
①関数生成DDLコマンド
③関数パリ表宣言
⑤関数結果を返す
create function getNthHighestSalary(N IN NUMBER)
return NUMBER
is
result NUMBER;
BEGIN
select salary into result
from (select rownum,salary
from (select distinct salary
from employee order by salary desc))
where rownum = N;
RETURN result;
END;
Reference
この問題について([SQL] LeetCode 177. Nth Highest Salary), 我々は、より多くの情報をここで見つけました https://velog.io/@hhhs101/SQL-LeetCode-177.-Nth-Highest-Salaryテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol