3.2.6.6. Automatic Properties for Temporal Types

TIMESTAMP and DATETIME columns can have automatic initialization and update properties:

• “Automatic initialization” means that for new rows the column is set to the current timestamp if you omit it from the INSERT statement.

• “Automatic update” means that for existing rows the column is updated to the current timestamp when you change any other column to a different value. (Setting a column to its current value does not count; this can in fact be done to prevent automatic updates.)

Before MySQL 5.6.5, you can designate any single TIMESTAMP column in a table to have either or both of those properties. You cannot have automatic initialization for one TIMESTAMP column and automatic update for another. ...

Get MySQL, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.