Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set MySQL-timestamp column defaults

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The following mainly brings you how to set the default value of the MySQL-timestamp column, hoping that how to set the default value of the MySQL-timestamp column can bring you practical use, which is also the main purpose of my editing this article. Okay, no more nonsense, let's just look at the following.

1. Refresh this data column both when creating new records and when modifying existing records TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP2. Set this field to the current time when creating new records, but do not refresh it when modifying them later

TIMESTAMP DEFAULT CURRENT_TIMESTAMP 3. Set this field to 0 when creating a new record and refresh it when modifying it later TIMESTAMP ON UPDATE CURRENT_TIMESTAMP 4. Set this field to a given value when creating a new record and refresh it when modifying it later

TIMESTAMP DEFAULT 'yyyy-mm-dd hh:mm:ss' ON UPDATE CURRENT_TIMESTAMP

For the above on how to set MySQL-timestamp column default values, we do not think very helpful. If you need to know more, please continue to pay attention to our industry information, I believe you will like these contents.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report