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 / venkateswara thiruvedhula

SELECT empno,
deptno,
sal,
RANK() OVER (PARTITION BY deptno ORDER BY sal
desc) "rank"
FROM emp;

EMPNO DEPTNO SAL rank
---------- ---------- ---------- ----------
7934 10 5000 1
7782 10 3000 2
7839 10 2000 3
7369 20 2950 1
7876 20 1700 2
7566 20 1100 3
7788 20 900 4
7902 20 900 4

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is sqlca in db2?

918


What is auto increment in sql?

1081


How can use stored procedures in sql?

1104


What is type and rowtype in pl sql?

985


Show how functions and procedures are called in a pl/sql block.

1077


What is linq to sql?

1107


what is the difference between join and union? : Sql dba

1060


What is trigger in flip flop?

980


what are all types of user defined functions? : Sql dba

1019


How can you save or place your msg in a table?

974


What are the different ways to optimize a sql query?

912


What is the purpose of design view?

971


what are the different type of normalization? : Sql dba

992


How can I tell if sql is running?

1017


What mean sql?

971