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

Define a temp table?

1031


what are the types of join and explain each? : Sql dba

1048


Mention what are different methods to trace the pl/sql code?

1223


What are keys in sql?

1007


When is the explicit cursor used ?

1041


What is rename command in sql?

1045


How do you optimize a stored procedure in sql?

970


What is sql comments?

1081


what are all the different types of indexes? : Sql dba

1061


Explain how you can copy a file to file content and file to pl/sql table in advance pl/sql?

1015


Explain what is sql?

1123


what is the difference between mysql_fetch_array and mysql_fetch_object? : Sql dba

1076


what is a field in a database ? : Sql dba

1071


Why procedure is used in sql?

1049


What is sqlcommand?

1032