Skip to content

Instantly share code, notes, and snippets.

@jamesonjlee
Created July 30, 2014 19:58
Show Gist options
  • Save jamesonjlee/0072a9068d820035bf81 to your computer and use it in GitHub Desktop.
Save jamesonjlee/0072a9068d820035bf81 to your computer and use it in GitHub Desktop.
timestamp can both be null and have a default
mysql> create table temp3 ( id int, bleh int default null default 1, tstamp timestamp null default CURRENT_TIMESTAMP );
Query OK, 0 rows affected (0.01 sec)
mysql> show create table temp3;
+-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| temp3 | CREATE TABLE `temp3` (
`id` int(11) DEFAULT NULL,
`bleh` int(11) DEFAULT '1',
`tstamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment