DEFAULT CURRENT_TIMESTAMP

Asked

Viewed 141 times

2

Using the DEFAULT CURRENT_TIMESTAMP when a UPDATE this date will also be updated to the date of UPDATE?

Or it and fixed inserted only once at the time of the INSERT?

  • 3

    It depends on how your table is.

1 answer

4

To update both the Insert and the update, both declarations are required:

DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP

More details on manual.

  • +1 DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP for last update fields and DEFAULT CURRENT_TIMESTAMP for when the record was created :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.