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

Explain cascading triggers.

574


Is primary key indexed by default in oracle?

548


How to execute a stored procedure in oracle?

620


What do you mean by merge in oracle and how can we merge two tables?

577


Explain integrity constraints?

669






How to retrieve values from data fields in record variables?

572


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?

526


Can we store images in oracle database?

554


How to create a new user account in oracle?

583


How to get last row id?

557


What is backup in Oracle?

573


What is the difference between hot backup and cold backup in oracle?

524


Can we call procedure inside function in oracle?

614


What is connection pooling in oracle?

552


What is oracle instant client?

566