how will I find the first 5 highest salaried employees in
each dept in oracle.

Answer Posted / ravindra reddy

select *from(select b.* from emp b order by sal desc)where rownum<=5 order by sal desc
------------------------------------------------------------
select *from(select b.*,rank() over(order by sal desc) from emp b)where rownum<=5

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Difference between inner join vs where ?

609


What is a trigger oracle?

564


How can we find out the current date and time in oracle?

641


How to list all indexes in your schema?

583


How to generate query output in html format?

567






What is a proxy class?

559


Explain the use of consistent option in exp command.

552


What happens if you use a wrong connect identifier?

503


what is a Nested Loop join?

1567


How to lock and unlock a user account in oracle?

616


Whether any commands are used for months calculation? If so, what are they?

597


What is SQL Tuning Advisor in Oracle?

633


Explain the use of parfile option in exp command.

526


how can db_files > maxdatafiles since db_files is for instance and the later is for database

2173


Describe an oracle table?

574