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


Please Help Members By Posting Answers For Below Questions

What pl/sql package consists of?

638


What are the steps for performance tuning.

847


What is acid property in a database?

587


how many ways to get the current time? : Sql dba

530


Can a key be both primary and foreign?

510






Explain the difference in execution of triggers and stored procedures?

573


How to run sql*plus commands in sql developer?

592


Is coalesce faster than isnull?

512


Why do we use triggers?

522


Can primary key be changed?

529


What is the use of desc in sql?

496


Is pl sql different from sql?

536


how to start mysql server? : Sql dba

615


what is a foreign key ? : Sql dba

611


Where are my tempfiles, I don't see them in v$datafile or dba_data_file?

555