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 are the different type of sql's statements ? : Sql dba
Does mysql_real_escape_string prevent sql injection?
What if we write return in procedure?
when MSQL8.0 is in market
How do I count rows in sql query?
What is nested table in pl sql?
Is a foreign key always unique?
What is assignment operator in pl sql?
What is minus?
Explain locks? : Transact sql
How to execute a stored procedure?
Is pl sql useful?
Is full outer join same as cross join?
Why do we use procedures in sql?
Enlist the characteristics of pl/sql?