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 is a trigger in sql?

1158


Are stored procedures faster than dynamic sql?

982


What are the different types of sql commands?

1065


What is fmtonly in sql?

1010


What is crud sql?

925


What is mdf ldf and ndf?

932


how many tables will create when we create table, what are they? : Sql dba

1022


Does postgresql run on the cloud?

1080


When is the explicit cursor used ?

982


Do ddl statements need commit?

925


How do you bind variables in pl sql?

1036


What are sql*plus environment variables?

1032


What is clustered index sql?

934


What does 0 mean in sql?

914


Why is a primary key important?

968