Select empname,salary from Employee a where N = (select count(distinct(salary)) from Employee b where a.salary<=b.salary);
* The above query is used to select the Nth highest salary with the name
SELECT MAX(Salary) FROM Employee
WHERE Salary NOT IN (SELECT MAX(Salary) FROM Employee );
*The above query is used to select the Second highest salary
* The above query is used to select the Nth highest salary with the name
SELECT MAX(Salary) FROM Employee
WHERE Salary NOT IN (SELECT MAX(Salary) FROM Employee );
*The above query is used to select the Second highest salary
No comments:
Post a Comment