How do you retrieve the last N records from a table?

Answer Posted / jyoti

We can retrieve last N records using Order by clause in the
query.

The ORDER BY clause using DESC
then give limits 0,N
for ex: SELECT * from table_name OREDER BY id DESC limit 0,10

It will return you last 10 records of the table.

Is This Answer Correct ?    1 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the savepoint statement.

615


what are all different types of collation sensitivity? : Sql dba

534


Why is normalization important?

549


Are ddl triggers fired for ddl statements within a pl/sql code executed using the dbms.sql package?

635


Compare sql & pl/sql

618






Explain what is rdbms?

593


What is pl/sql table? Why is it used?

574


Does sql require a server?

534


what is the difference difference between procedure and packages

9247


How to get each name only once from an employee table?

624


What are the different type of joins in sql?

552


Does truncate require commit?

555


How do I tune a sql query?

518


Is grant a ddl statement?

459


What is composite primary key in sql?

532