There are many solutions in stackoverflow in which the goal was to read the last n rows of the table using either an auto-increment field or a timestamp: for example, the following query retrieves the last ten records from a table named tab in descending order of the values ββof the field named id, which is the auto increment field in the table:
Select * from tab order by id desc limit 10
My question is: is there any alternative way without having to get the auto-zoom field or timestamp to complete the task in order to get the same result?
Tips. The motivation to ask this question comes from the fact that: when we store records in tables and when we query a database with a simple query without specifying any criteria like:
Select * from tab
Then the output order is the same as the order of records inserted in the table. So, is there a way to get the records in the reverse order that they were entered into the database?
source share