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 / nilesh

You can also use a query like

select e.ename,e.sal from emp e where 3>(select count
(distinct(b.sal)) from emp b where b.sal>e.sal)

as explained by Kalyan Kumar in Answer 2 and for making
it parameterised u can replace 3 by &sal so that when it is
executed it will ask you a number
if you enter 3 it will give you best three salaries , if
you enter 4 it will give you best 4 salaries etc.

Is This Answer Correct ?    9 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is pl sql collection?

947


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

974


How is debugging done?

958


Is record in oracle pl sql?

944


What is pl sql block in dbms?

991


Is it possible to create startup or shutdown trigger for on-schema?

1012


Define select, insert, create, delete, update, drop keywords

1036


How do I find duplicates in the same column?

1060


What is the difference between truncate and drop statements?

1165


Why procedure is used in sql?

1026


What does trigger mean in psychology?

947


What is sqlite format?

1173


What is difference between sql function and stored procedure?

990


How many scalar data types are supported in pl/sql?

1028


What is the difference between database trigger and stored procedure?

1059