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...

how to retrieve the top 3 salaries of the table using rownum

Answer Posted / rajnish chauhan

you can put any number on Rnk.

---Top 3 salary
SELECT ROWNUM,ename,sal
FROM (
SELECT ename,sal,rank() over(ORDER BY sal DESC)rnk
FROM emp)a WHERE rnk<4

-----Top 3 Salary only
SELECT ROWNUM,ename,sal
FROM (
SELECT ename,sal,rank() over(ORDER BY sal DESC)rnk
FROM emp)a WHERE rnk=3

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we rollback after truncate?

1075


What is sql select statement?

1089


What is a sql profiler?

1068


Can we join 3 tables in sql?

1111


Is sql a scripting language?

1086


What are tuples in sql?

1200


how to rename an existing column in a table? : Sql dba

1086


What is a .db file?

1043


What is query syntax?

1020


What are inner and outer joins examples of both?

1013


what are the performance and scalability characteristics of mysql? : Sql dba

1038


How many types of indexes are there in sql?

1048


What is input buffer in sql*plus?

1293


what is a primary key? : Sql dba

1088


What does the file extension accdb stand for?

1019