user1387147
user1387147

Reputation: 955

Is it possible to get last update time of the row in sql

Is it possible to get last updated time and date of the row using MYSQL server.

Upvotes: 9

Views: 9803

Answers (1)

Jigar Pandya
Jigar Pandya

Reputation: 5987

Well there is no inbuild feature exists with MySQL. Though you can get the same effect by adding a timestamp column:

ALTER TABLE NAMEYOURTABLE
   ADD COLUMN last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP

using above to create timestamp with name last_update column will make it pretty much automatically managed and updated. Now you can select from NAMEYOURTABLE the last updated row based on the timestamp.

Upvotes: 11

Related Questions