Here i have posted three methods to find second highest salary of an employee.
select max(salary) from employee where salary not in(select max(salary) from employee)
OR
select max(salary) from employee where salary <=(select max(salary) from employee)
OR
SELECT salary from(select salary from employee where rownum<=2 order by salary asc ) employee where rownum = 1;
select max(salary) from employee where salary not in(select max(salary) from employee)
OR
select max(salary) from employee where salary <=(select max(salary) from employee)
OR
SELECT salary from(select salary from employee where rownum<=2 order by salary asc ) employee where rownum = 1;
No comments:
Post a Comment