Wednesday, February 1, 2012

to find the 2nd hightest salary

SQL> select employee_id,salary from employees  e where
  2  2 =(select count(distinct salary) from employees  where e.salary<=salary)
  3  /
output
EMPLOYEE_ID     SALARY
----------- ----------
        101      17000
        102      17000


all the best.....