John Christy
John Christy

Reputation: 373

Check for updation of records in MySQL

I wish to know is it possible to check is there any updation in records in a table for specific period of time

Id Name Ligin

0 Abc1 Yes

1 Abc 2 No

I mean i wish to check if there any updation of these two rows in 3 months without setting any Datetime

Upvotes: 0

Views: 56

Answers (2)

Olexa
Olexa

Reputation: 587

Did you mean, without setting any DateTime manually?

There is a way to create an auto-update DATETIME or TIMESTAMP column:

CREATE TABLE ... (
  ...,
  last_update DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

Then just select records by giving a constraint for last_update in WHERE clause.

See more details here: http://dev.mysql.com/doc/refman/5.6/en/timestamp-initialization.html

Upvotes: 0

Sashi Kant
Sashi Kant

Reputation: 13455

No In MYSQL you cannot, get the timestamp of the row created or updated, you need to define your methods(adding a column), to do so

Upvotes: 2

Related Questions