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
What is the use of prepared statement?
What are the two types of periodical indexes?
What is the basic structure of an sql?
what is a tablespace? : Sql dba
What is sap sql anywhere?
Which is faster count (*) or count 1?
what are the difference between clustered and a non-clustered index? : Sql dba
What is percent sign in sql?
Can you call pl/sql package functions from within a fast formula?
Why self join is used in sql?
what is the difference between truncate and drop statements? : Sql dba
What does subquery mean in sql?
How to check if a column is nullable before setting to nullable?
What is left join example?
how to include character strings in sql statements? : Sql dba