how to retrieve the top 3 salaries of the table using rownum
Answer Posted / phantom coding
select * from (select rownum as rnum,t.* from emp order by
sal desc) a where rnum < 4
the alias to rownum (i.e:rnum) should be used. If rownum is
used for the constraint then the query would return the
first three rows it hits and the results could be wrong.
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
Table A Table B 1 1 2 1 3 1. Union & union all --> A Union B , A Union all B 2. Minus , Intersect --> A minus B , B Minus A , A Intersect B 3. Joins A join B , A Left Join B A Right Join B , A full Join B 4. %Type - Uses & Benifit 5. Truncate & Delete 6. Pragma Autonomus Transaction 7. how to Perform DDL from function or procedure 8. Can we have DML inside Function 9. Rank & Dense Rank diffrence 10. Water Mark in Oracle 11. Index , Can we have index in all column of table if no then why ?
Which language is used in sql?
What is the sql case statement?
What does select * from mean in sql?
What is hibernate and its relation to sql?
Explain alias in sql?
When to use inner join and left join?
What is composite data type in pl sql?
What's the difference between inner join and left join?
Why do we use procedures?
Can you do multiple joins in sql?
How to return an array from java to pl/sql?
Explain the difference between 'between' & 'and' operators in sql
Is sql database free?
How many sectors are in a partition?