From e2d5a50262ff214e3b5870f8a2137fd0cbf45229 Mon Sep 17 00:00:00 2001 From: Priyam2773 Date: Fri, 31 Oct 2025 00:00:58 +0530 Subject: [PATCH] Create function to get Nth highest salary Implement a function to retrieve the Nth highest salary from the Employee table. --- 177. Nth Highest Salary | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 177. Nth Highest Salary diff --git a/177. Nth Highest Salary b/177. Nth Highest Salary new file mode 100644 index 0000000..3ea8fe1 --- /dev/null +++ b/177. Nth Highest Salary @@ -0,0 +1,11 @@ +CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT +BEGIN +SET N = N-1; + RETURN ( + SELECT DISTINCT(salary) from Employee order by salary DESC + LIMIT 1 OFFSET N + + ); +END + +#pls upvote if you find solution easy to undestand....!! Thanks..!!!