When you create a table that has a type of field timestamp in the table, the statement is generated by default:
CREATE TABLE ' test ' ( ' id ' int (one) default null, ' ctime ' timestamp not null default Current_timestamp on UPDATE CU Rrent_timestamp) Engine=innodb DEFAULT CHARSET=GBK
Assuming that there are two field types of timestamp, the resulting statement is:
CREATE TABLE ' test ' ( ' id ' INT (one) default null, ' ctime ' TIMESTAMP not null default Current_timestamp on UPDATE CU Rrent_timestamp, ' utime ' TIMESTAMP not NULL default ' 0000-00-00 00:00:00 ') engine=innodb default CHARSET=GBK
TIMESTAMP setting defaults are default Current_timestamp,
TIMESTAMP settings as the table changes and your own active update is on update current_timestamp
A table can have at most only one field set Current_timestamp (current time)
1. TIMESTAMP DEFAULT current_timestamp on UPDATE current_timestamp
Refreshes the data column when new records are created and existing records are changed
2. TIMESTAMP DEFAULT Current_timestamp
Set this field to the current time when creating a new record, but do not refresh it when you change it later
3. TIMESTAMP on UPDATE current_timestamp
Set this field to 0 when creating a new record, and refresh it later when you change it
Viewmode=contents "style=" Color:rgb (255, 153, 0); Text-decoration:none; font-family:arial; font-size:14px; line-height:26px; " >itmyhome
Source: http://blog.csdn.net/itmyhome1990/article/details/39342245
MySQL TIMESTAMP (timestamp) detailed explanation