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

How do I create a sql script?

1053


What are its different types of dbms?

957


What is the difference between row level and statement level trigger?

960


How can I delete duplicate rows?

966


how does a local variable is defined using t-sql? : Transact sql

951


What is pessimistic concurrency control? : Transact sql

1026


what are the advantages a stored procedure? : Sql dba

926


How do you identify a primary key?

1013


Can unique keys be null?

853


What is a data manipulation language?

967


How do I find duplicates in a single column in sql?

954


what is 'mysqladmin' in mysql? : Sql dba

974


What is a Mapplet?

1058


What are the various levels of constraints?

1061


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

876