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

Answers were Sorted based on User's Feedback



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

Answer / chandrasekar.ramasamy

select sal from( select rownum,e.* from empmaster e order
by sal desc) where rownum < 4

Is This Answer Correct ?    20 Yes 7 No

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

Answer / dhiman sarkar

select empname,sal from (select empname,sal from dh1 order
by sal desc)
where rownum < =4
order by sal desc

Is This Answer Correct ?    17 Yes 7 No

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

Answer / kalyan kumar

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

Is This Answer Correct ?    19 Yes 10 No

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

Answer / vik

select empno, ename, sal from (select * from emp order by
sal desc) where rownum < 4

Is This Answer Correct ?    8 Yes 1 No

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

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

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

Answer / rameshwar gupta

select ename ,sal from (select ename,sal from emp order
by sal desc)
where rownum<4

Is This Answer Correct ?    8 Yes 3 No

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

Answer / moorthy(information dynamic)

select sal,rank()over (order by sal desc) from emp where
rownum < = 3;

Is This Answer Correct ?    3 Yes 0 No

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

Answer / nitesh

select sal from emp e where 3>=(select count(distinct sal)
from emp where sal>e.sal) order by sal desc;

Is This Answer Correct ?    5 Yes 3 No

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

Answer / akki julak

select sal from (select rownum,sal from emp order by sal
desc)
where rownum<4;

Is This Answer Correct ?    2 Yes 0 No

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

Answer / swapnareddy

select sal from emp a where 3>(select
count(distinct(sal))from emp b where a.sal<b.sal);

Is This Answer Correct ?    4 Yes 3 No

Post New Answer

More SQL PLSQL Interview Questions

What is Collation Sensitivity ? What are the various type ?

0 Answers  


What are the disadvantages of file system?

0 Answers  


HOW TO APPEAR FOR ONLINE EXAMS OF SQL & PL/SQL? WHICH BOOKS WILL BE BETTER FOR REFERENCE TO QUALIFY THESE EXAMS? ARE THERE ANY MODEL PAPERS AVAILABLE IN THE MARKET ABOUT SQL & PLSQL?

2 Answers  


What is data definition language?

0 Answers  


3. Select sum(a) sum_1,max(a) max_1 ,count(a) count_1 from ( ( select 1 a from dual union all Select to_number(‘2011’) a from dual union all select 1 a from dual) union select 2 b from dual);

1 Answers   Fintellix,


use of IN/ANY/ALL

5 Answers   Ramco,


What is join view in sql?

0 Answers  


What is Difference between StoredProcedure and function?

3 Answers  


What does fetching a cursor do?

0 Answers  


how would you get the current date in mysql? : Sql dba

0 Answers  


What is form and report?

0 Answers  


How to fix oracle error ora-00942: table or view does not exist

0 Answers  


Categories