display records from 5 to 9 using rowid or rownum

Answers were Sorted based on User's Feedback



display records from 5 to 9 using rowid or rownum..

Answer / vinay shankar

select * from emp
where rownum <=9
minus
select * from emp
where rownum <5

Is This Answer Correct ?    31 Yes 6 No

display records from 5 to 9 using rowid or rownum..

Answer / chiru

select * from (select rownum r ,a.* from emp a ) where r between 5 and 9

Is This Answer Correct ?    7 Yes 0 No

display records from 5 to 9 using rowid or rownum..

Answer / ramaraju

select
ename
from
emp
order by ename
offset 4 rows
fetch next 5 rows only;

try this answer oracle 12c introduced offset fetch rows.

Is This Answer Correct ?    1 Yes 0 No

display records from 5 to 9 using rowid or rownum..

Answer / hari

select * from (select rownum rm,id from emp where rownum<=9) where rn >=5)

Is This Answer Correct ?    4 Yes 5 No

display records from 5 to 9 using rowid or rownum..

Answer / satya

select empno,ename,sal from emp
group by rownum,empno,ename,sal
having rownum between 5 and 9;

Is This Answer Correct ?    2 Yes 9 No

Post New Answer

More SQL PLSQL Interview Questions

HOW CAN I FIND MAX SAL ,ENAME FROM EMP TABLE.

16 Answers  


What are sql indexes?

0 Answers  


what are the advantages a stored procedure? : Sql dba

0 Answers  


Are views faster than queries?

0 Answers  


What is a string data type in sql?

0 Answers  






What is difference between db2 and sql?

0 Answers  


What will you get by the cursor attribute sql%rowcount?

0 Answers  


What are the syntax and use of the coalesce function?

0 Answers  


what are the differences between char and nchar? : Sql dba

0 Answers  


How to convert comma separated string to array in pl/sql?

0 Answers  


Differentiate between % rowtype and type record.

0 Answers  


What action do you have to perform before retrieving data from the next result set of a stored procedure ?

0 Answers   Microsoft,


Categories