This example is change the column named "updated_at" in the table "test_tables" : when update the column also auto update value of this column to current timestamp
ALTER TABLE test_tables
CHANGE updated_at
updated_at TIMESTAMP
DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP;
reference
https://www.tutorialkart.com/mysql/update-to-current-timestamp-whenever-row-is-updated-in-mysql/
No comments :
Post a Comment