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 pl sql collection?
Explain the purpose of %type and %rowtype data types with the example?
How is debugging done?
Is record in oracle pl sql?
What is pl sql block in dbms?
Is it possible to create startup or shutdown trigger for on-schema?
Define select, insert, create, delete, update, drop keywords
How do I find duplicates in the same column?
What is the difference between truncate and drop statements?
Why procedure is used in sql?
What does trigger mean in psychology?
What is sqlite format?
What is difference between sql function and stored procedure?
How many scalar data types are supported in pl/sql?
What is the difference between database trigger and stored procedure?