You can include the NULL attribute in the definition of a TIMESTAMP column to allow the column to contain NULL values. For example : Timestamp : Data Types MySQL TUTORIALS


MySQL TUTORIALS » Data Types » Timestamp »

 

You can include the NULL attribute in the definition of a TIMESTAMP column to allow the column to contain NULL values. For example


mysql>
mysql> CREATE TABLE myTable
    -> (
    ->   ts1 TIMESTAMP NULL DEFAULT NULL,
    ->   ts2 TIMESTAMP NULL DEFAULT 0,
    ->   ts3 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
    -> );
Query OK, rows affected (0.01 sec)

mysql>
mysql> desc myTable;
+-------+-----------+------+-----+---------------------+-------+
| Field | Type      | Null | Key | Default             | Extra |
+-------+-----------+------+-----+---------------------+-------+
| ts1   | timestamp | YES  |     | NULL                |       |
| ts2   | timestamp | YES  |     | 0000-00-00 00:00:00 |       |
| ts3   | timestamp | YES  |     | CURRENT_TIMESTAMP   |       |
+-------+-----------+------+-----+---------------------+-------+
rows in set (0.02 sec)

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



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

MySQL TUTORIALS

 Navioo Data Types
» Timestamp