rohitnaidu19
rohitnaidu19

Reputation: 693

mysql find insert timestamp

Is there any way to sort rows in a select query by the insert timestamp without having a column for timestamp. So i want to find the rows inserted recently, but there is no column that records insert timestamp. Is here any internal record for each row?

There is no primary key,foreign key for the table.

Upvotes: 0

Views: 154

Answers (2)

user7282
user7282

Reputation: 5196

If you have a primary key field, (and that Primary Key need not be an AUTO INCREMENT one), then this can be achieved like

SELECT * FROM table ORDER BY _rowid DESC

Upvotes: 0

Salil
Salil

Reputation: 47492

No, you can find out the result if you have primary key auto-incremental. But there is possibility that two consecutive rows may have inserted on different day/month/year. So, only depending on the primary you can't find out the recent records.

Upvotes: 1

Related Questions