how to get second highest sal of emp table

Answer Posted / anilchandu

Select * from emp x where 2=(select count(distinct sal)
from emp y where x.sal<=y.sal)


where x,y are alias names.

If you want 3rd heighest salary then just replace 2 by 3

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a connect identifier?

545


how to make an oracle object

1862


query optmization techniques and quwry analyser+projects+ppts

1938


What is oracle update statement with inner join ?

588


What is a tns service name?

540






Explain the use of parfile option in exp command.

530


How do I connect to oracle database?

542


How to invoke the original export import utilities?

512


What is the difference between sharding and partitioning?

507


How to define a cusotmer as a supplier in ORACLE R12

1730


What is the effect of setting the value "all_rows" for optimizer_goal parameter of the alter session command? What are the factors that affect optimizer in choosing an optimization approach?

532


How to connect to a local oracle 10g xe server?

539


How to invoke the data pump export utility?

569


How to drop an index in oracle?

611


What is open database communication (odbc) in oracle?

551