What is automatic initialization and updating for TIMESTAMP in a MySQL table?

In MySQL, there is a TIMESTAMP datatype that provides features like automatic initialization and updating to current time and date.

If a column is auto-initialized, then it will be set to current timestamp on inserting a new row with no value for the column.

If a column is auto-updated, then its value will be updated to current timestamp when the value of any other column in the same row is updated.

We can mark a column as DEFAULT to prevent this auto-initialize and auto-update behavior.

Leave a Reply

Your email address will not be published. Required fields are marked *