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 database event trigger?

1115


What is composite data type in pl sql?

1061


why does the selected column have to be in the group by clause or part of an aggregate function? : Sql dba

1076


What found sql?

914


What is difference between left and right outer join?

957


Does mysql support pl sql?

1122


What is sql partition function?

1153


How to use distinct and count in sql query? Explain

984


Can I copy :old and :new pseudo-records in/to an oracle stored procedure?

1175


What are sql built in functions?

908


what is myisam? : Sql dba

1029


Can we call dml statement in function?

1003


What is forward declaration in pl sql?

1030


How to select 10 records from a table?

1121


Is primary key clustered index?

921