diff --git a/SQL/NthHighestSalary b/SQL/NthHighestSalary new file mode 100644 index 0000000..6843128 --- /dev/null +++ b/SQL/NthHighestSalary @@ -0,0 +1,9 @@ +CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT +BEGIN +DECLARE M INT; +SET M=N-1; + RETURN ( + select DISTINCT(salary) from employee order by salary DESC limit M,1 + + ); +END