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

Rownum assigned at the runtime on the basis of rownum you
not fetch last three records.

for no records output: Rownum always use <= or >= , if use
rownum < or > its giving no output.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the various restrictions imposed on view in terms of dml?

690


How do I write a cron which will run a sql query and mail the results to agroup?

713


What is record data type?

677


Explain commit, rollback and savepoint.

766


What is sql*loader?

757






What are the advantages of stored procedure?

721


What is the difference between a subquery and a join?

699


what are different types of keys in sql?

767


What is sql analyzer?

759


what is innodb? : Sql dba

762


Is sql developer case sensitive?

723


What is database white box testing and black box testing?

852


how can we find the number of rows in a table using mysql? : Sql dba

790


How much does a sql dba make? : SQL DBA

669


What is orm in sql?

723