select top 3 sal from each dept?

Answer Posted / chiru

select *
from (select row_number() over(partition by deptno order by sal desc) r,
b.*
from (select rownum num, a.* from emp a order by sal desc) b)
where r <= 3

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 serial sql?

529


Why do we use triggers?

522


What is replication id?

524


Explain the purpose of %type and %rowtype data types?

506


what is a field in a database ? : Sql dba

547






What is the basic structure of an sql?

576


Is sql free?

501


What is pl sql record in oracle?

567


Is inner join faster than left join?

638


What are sql queries used for?

538


how to add a new column to an existing table in mysql? : Sql dba

587


List and explain the different types of join clauses supported in ansi-standard sql?

826


Can a table contain multiple primary key’s?

631


what is transaction? : Sql dba

532


What are reports usually used for?

568