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

Answer Posted / satish

SELECT SAL SECOND_MAX_SAL FROM (SELECT SAL,DENSE_RANK() OVER(ORDER BY SAL DESC) RANK FROM EMP) WHERE RANK=2;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is procedure overloading in oracle?

546


How to define a specific record type?

624


What to do if the startbd.bat failed to start the xe instance?

611


Why do I get java.lang.abstractmethoderror when trying to load a blob in the db?

558


What are the attributes of cursor?

591






What are oracle functions?

555


What is a oracle database?

610


What is proxy method?

545


Explain drop constraint oracle?

593


How to convert characters to dates in oracle?

563


State the difference along with examples between Oracle 9i, Oracle 10g and Oracle 11i.

609


How to upsert (update or insert into a table)?

541


How to create a stored function in oracle?

593


How do I spool to a csv formatted file using sqlplus?

550


How to create a stored program unit?

583