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 / gnreddy

try this one.
select * from emp where 3 >( select count(1) from emp e where e.rowid > emp.rowid);

Is This Answer Correct ?    7 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between an inner join and an outer join?

512


What is data manipulation language?

696


How do you use collections in procedure to return the resultset?

1786


Which sql statement is used to return only different values?

500


What is a nested table in word?

529






what is 'mysqldump'? : Sql dba

569


What are the packages in pl sql?

568


Explain the components of sql?

587


how to create a new view in mysql? : Sql dba

492


How do I restart sql?

524


What is rename in sql?

548


How many types of functions are there in sql?

501


How do you update a table in sql?

518


Which is better stored procedure or query?

544


What does dml mean?

543