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
What is rename in sql?
Is crud a cuss word?
What are different types of statements supported by sql?
What is the difference between the implicit and explicit cursors?
what tools available for managing mysql server? : Sql dba
What are all the different types of indexes?
What is before trigger?
What is procedure in pl sql?
Can we connect to postgresql using sql developer?
What are the two characteristics of a primary key?
why does the selected column have to be in the group by clause or part of an aggregate function? : Sql dba
What is the use of double ampersand (&&) in sql queries? Give an example
What does where 1 1 mean in sql?
What are the different dml commands in sql?
What are views in sql?