Timestamp-type automatic update time when the record is updated in MySQL

Source: Internet
Author: User

In MySQL, when the record is updated, I use navicat for the timestamp type automatic update time. If I select timestamp for the date type, I find that IDE has an option:

View the automatically generated SQL statement by IDE: Write 'lastupdate' timestamp NOT NULL DEFAULT '2017-00-00 00:00:00 'ON UPDATE CURRENT_TIMESTAMP if this option is removed: the difference between 'lastupdate' timestamp not null default '2017-00-00 00:00:00 'Is that "on update CURRENT_TIMESTAMP, its function is to automatically update the lastUpdate time to the current time of the system when the record is changed. Note: The change is emphasized. In other words, this value will not be automatically updated even if the update statement is used but the content does not change.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.