how to retrieve last tree records from table?
select *from emp where rownum > (select count(*)-3 from
emp);
i am using this query to get last three records from table
but its not giving any output, so please tell me what is the
error in this query.

Answer Posted / alok narayan

select * from (select * from emp order by rowid desc )
where rownum <= 3 order by rowid;

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When a dml statement is executed, in which cursor attributes, the outcome of the statement is saved?

843


What are sql indexes?

740


What is difference between stored procedure and trigger?

743


explain advantages of myisam over innodb? : Sql dba

802


What are local and global variables and their differences?

810






Why is a trigger used?

695


Is like operator in sql case sensitive?

730


Why having clause is used in sql?

725


What does pragma mean?

712


State some properties of relational databases?

758


How do I install microsoft sql?

714


Is it possible to read/write files to-and-from PL/SQL?

840


What is sql entity?

742


Which one is better subquery or joins?

775


tell us something about heap tables. : Sql dba

819