Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

select top 3 sal from each dept?

Answer Posted / sambu

select r.sal,r.rank,r.dept high from
(select deptno,sal,dense_rank() over (partition by deptno
order by sal desc) rank
from emp) r
where r.rank=3;


The above query gives the following result

DEPTNO SAL HIGHEST
------ ----- -------
10 1300 3
20 1100 3
30 1500 3

Is This Answer Correct ?    3 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What operating systems are supported by oracle sql developer?

1015


Are stored procedures faster than queries?

990


What is faster join or subquery?

1066


What is sql constant?

1104


What are different methods to trace the pl/sql code?

1171


Is sql developer case sensitive?

1048


How do you declare a user-defined exception?

1076


Which column in the user.triggers data dictionary view shows that the trigger is a pl/sql trigger?

1086


What are the most important ddl statements in sql?

1188


What is the use of & in pl sql?

1097


Can primary key be changed?

953


Do we need to create index on primary key?

966


Can a key be both primary and foreign?

1055


How do you define a foreign key?

1064


What is left join in sql?

1093