We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 32d97e8 commit 9e660c3Copy full SHA for 9e660c3
sql_solutions/177_nth_highest_salary.sql
@@ -0,0 +1,10 @@
1
+CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
2
+BEGIN
3
+SET N=N-1;
4
+ RETURN (
5
+ # Write your MySQL query statement below.
6
+ Select distinct(salary) from Employee
7
+ Order by salary desc
8
+ LIMIT 1 OFFSET N #Offset skips n rows and we can't do any calculation like n-1 here, so we had to set that out before
9
+ );
10
+END
0 commit comments