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

Write the command to remove all players named sachin from the players table.

922


What is right join sql?

711


Is sql harder than python?

818


How do I copy a table in sql?

693


What is the difference between inner join and left join?

735






What is a left join?

692


What is the sql query to display the current date?

753


How many scalar data types are supported in pl/sql?

712


How do I save a sql query?

730


what is the difference between clustered and non clustered index in sql? : Sql dba

737


What does fetching a cursor do?

801


Define overloaded procedure?

803


When should I use nosql database?

724


what are the join types in tsql? : Transact sql

755


What are different types of tables in sql?

699