find out the second highest salary?

Answer Posted / abhijit ramakant parb

select min(a.sal) from(select distinct d.sal from emp d
order by sal desc) a where rownum<=2;

To retrieve all columns

select * from emp where sal=(select min(a.sal) from(select
distinct d.sal from emp d order by sal desc) a where
rownum<=2);

Is This Answer Correct ?    12 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a subquery?

604


Explain about your project and its relation to the current job position you are applying to?

530


Database crashes. Corruption is found scattered among the file system neither of your doing nor of Oracles. What database recovery options are available? Database is in archive log mode.

1523


What is the difference between formal parameters and actual parameters?

534


How to create a server parameter file?

565






What is the difference between a primary key & a unique key?

579


Difference between open_form and call_form in oracle.

664


what is partitioning? Types of partitioning. explain? what is the new kind of partitioning type introduced in 9i?

1840


what are the advantages of running a database in archive log mode?

1725


How to view the data files in the current database?

582


can u send the sql dumps to sivakumarr1987@gmail.com plz help me

2582


What is a lookup table in oracle?

528


how to do daily transactions with out sql* loader control file regesterd in apps?

1211


How to check the oracle tns settings?

564


What is the maximum limit on the number of columns in a table?

541