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

Answer Posted / shareef

select ename,empno,sal,r from(select ename,empno,sal,dense_rank() over(order by sal desc) r from emp) where r=3; ----by using dense_rank()

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 a table index?

566


Explain the use of file option in exp command.

601


Using the relations and the rules set out in the notes under each relation, write statements to create the two sequence generators specified in the notes.

1652


How to define an anonymous block?

621


What is the quickest way to export a table to a flat file?

575






How to rename an index?

588


How to check the oracle tns settings?

575


What is a private synonym?

1088


How to define an oracle cursor variable?

569


Is postgres faster than oracle?

561


How do I uninstall oracle client from windows?

538


How to open and close an explicit cursor in oracle?

579


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

1850


How to start your 10g xe server from command line?

548


What are oracle functions?

555