When you create a table with a field type of timestamp, the default build statement for that field is:
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
If there are two field types 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 automatically update as the table changes is on update current_timestamp
There can be at most one field set in a table 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 modified
2. TIMESTAMP DEFAULT Current_timestamp
This field is set to the current time when a new record is created, but it is not refreshed when you modify it later
3. TIMESTAMP on UPDATE current_timestamp
Set this field to 0 when creating a new record, and refresh it later when you modify it
Reprint Please specify source: http://blog.csdn.net/itmyhome1990/article/details/39342245
MySQL TIMESTAMP (timestamp) detailed