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
tell us something about heap tables. : Sql dba
How to place comments in pl/sql?
How does left join work in sql?
How to look at the current sql*plus system settings?
How insert into statements in sql?
Does truncate require commit?
How to create a menu in sqlplus or pl/sql?
What are the types of subqueries?
What language is oracle sql developer?
Define select, insert, create, delete, update, drop keywords
How do I delete a trigger?
Can ddl statements be used in pl/sql?
How many clustered indexes can you have?
what is clause? : Sql dba
what is table? : Sql dba