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
When can we use the where clause and the having clause?
What are the basic techniques of indexing?
what is the difference between primary key and unique key? : Sql dba
What is offset in sql query?
what are the differences among rownum, rank and dense_rank? : Sql dba
Is inner join faster than left join?
How do you rank data in sql?
What is flag in sql?
what is a table in a database ? : Sql dba
what is the difference between blob and text? : Sql dba
What is procedure and function in sql?
What is the sql case statement?
What is pragma in pl sql?
Can a varchar be a primary key?
What is faster join or subquery?