Mega Code Archive

 
Categories / MySQL Tutorial / Data Types
 

TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP

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 | +---------------------+ 2 rows in set (0.00 sec) mysql> mysql> drop table t; Query OK, 0 rows affected (0.00 sec)