問題
https://leetcode.com/problems/nth-highest-salary/
解いた
CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT BEGIN RETURN ( # Write your MySQL query statement below. SELECT DISTINCT Salary FROM (SELECT DENSE_RANK() OVER(ORDER BY Salary DESC) AS 'rank', Salary FROM Employee) E WHERE E.rank = N ); END
結果