TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP : timestamp « Data Types « MySQL Tutorial






mysql>
mysql>
mysql> CREATE TABLE t (ts TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP);
Query OK, 0 rows affected (0.02 sec)

mysql>
mysql> INSERT INTO t VALUES (NOW());
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO t VALUES (CURRENT_TIMESTAMP);
Query OK, 1 row affected (0.00 sec)

mysql>
mysql> select * from t;
+---------------------+
| ts                  |
+---------------------+
| 2007-07-23 19:09:19 |
| 2007-07-23 19:09:19 |
+---------------------+
2 rows in set (0.00 sec)

mysql>
mysql> drop table t;
Query OK, 0 rows affected (0.00 sec)








10.24.timestamp
10.24.1.The timestamp data type stores the time that a row was last changed
10.24.2.TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00'
10.24.3.TIMESTAMP NULL DEFAULT NULL
10.24.4.You can include the NULL attribute in the definition of a TIMESTAMP column to allow the column to contain NULL values. For example:
10.24.5.mysql> SELECT MICROSECOND('2010-12-10 14:12:09.019473');
10.24.6.TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP