Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

find nth highest salary of an employee

#Method 1
SELECT salary FROM Employee ORDER BY salary DESC LIMIT N-1, 1

#Method 2
SELECT salary FROM Employee AS e1 
WHERE n-1=(SELECT COUNT(DISTINCT,salary) FROM Employee AS e2 
           WHERE e2.salary>e1.salary)
 
PREVIOUS NEXT
Tagged: #find #nth #highest #salary #employee
ADD COMMENT
Topic
Name
5+3 =