Query to get max and second max in oracle in one query ?

Answer Posted / sarmistha mohanty

select * from (
select SAL,
row_number() over (partition by 1 order by SAL DESC)
as rank
from <table name> ) where rank in (1,2)

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Will you be able to store pictures in the database?

642


In which language oracle has been developed?

650


What are the different editions of oracle?

593


What are the built-in functions used for sending Parameters to forms ?

2850


Give the various exception types.

551






I am using an Oracle 8i Database my data contains Clob data. I am using toad version 7.6 i am able to get the data in toad but unable to extract the data in excel.when trying to extract the data into the excel the toad error says out of memory. Can any body please help me to extract the data through the same toad version. Thanks in advance

1851


Does oracle partitioning improve performance?

552


Give the various rollback segment states.

579


Explain implicit cursor.

560


State all possible different index configurations a table can possibly have?

572


How does Oracle guarantee data integrity of data changes?

1938


Query to retrieve record for a many to many relationship ?

2081


What is an oracle recycle bin?

551


How to store only time; not date and time?

557


Explain oracle’s system global area (sga).

628