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

Can variables be used in sql statements?

747


What is acid property in a database?

763


What is sql stand for?

743


What is pl/sql table? Why is it used?

736


Is sql dba a good career? : SQL DBA

712






what are null values? : Sql dba

708


Mention what is the function that is used to transfer a pl/sql table log to a database table?

662


What is a sql schema used for?

729


What is application trigger?

733


Define SQL and state the differences between SQL and other conventional programming Languages?

871


When are we going to use truncate and delete?

716


What is the size of partition table?

741


What is a unique constraint?

809


What are the differences between in and exists clause?

784


How do I find duplicates in a single column in sql?

733