2030 Automatic Initialization and Updating for TIMESTAMP and DATETIME The default depends on whether the  DEFAULT  clause specifies  CURRENT_TIMESTAMP  or a constant value. With  CURRENT_TIMESTAMP , the default is the current timestamp. CREATE TABLE t1 ( ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP, dt DATETIME DEFAULT CURRENT_TIMESTAMP ); CREATE TABLE t1 ( ts TIMESTAMP DEFAULT 0, dt DATETIME DEFAULT 0 ); CREATE TABLE t1 ( ts TIMESTAMP DEFAULT 0 ON UPDATE CURRENT_TIMESTAMP, dt DATETIME DEFAULT 0 ON UPDATE CURRENT_TIMESTAMP ); CREATE TABLE t1 ( ts1 TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- default 0 ts2 TIMESTAMP NULL ON UPDATE CURRENT_TIMESTAMP -- default NULL ); CREATE TABLE t1 ( dt1 DATETIME ON UPDATE CURRENT_TIMESTAMP, -- default NULL dt2 DATETIME NOT NULL ON UPDATE CURRENT_TIMESTAMP -- default 0 ); •Specify the  NULL  attribute. This also causes the column to permit  NULL  values, which means that you cannot assign the current timestamp by setting the column to  NULL . Assigning  NULL  sets the •Define the column with a  DEFAULT  clause that specifies a constant default value. •Alternatively, if  explicit_defaults_for_timestamp  is disabled, do either of the following: •Enable the  explicit_defaults_for_timestamp  system variable. In this case, the  DEFAULT CURRENT_TIMESTAMP  and  ON UPDATE CURRENT_TIMESTAMP  clauses that specify automatic initialization and updating are available, but are not assigned to any  TIMESTAMP  column unless explicitly included in the column definition. TIMESTAMP  and  DATETIME  columns have no automatic properties unless they are specified explicitly, with this exception: If the  explicit_defaults_for_timestamp  system variable is disabled, the  first TIMESTAMP  column has both  DEFAULT CURRENT_TIMESTAMP  and  ON UPDATE CURRENT_TIMESTAMP if neither is specified explicitly. To suppress automatic properties for the first  TIMESTAMP  column, use one of these strategies: DATETIME  has a default of  NULL  unless defined with the  NOT NULL  attribute, in which case the default is 0. The default in this case is type dependent.  TIMESTAMP  has a default of 0 unless defined with the  NULL attribute, in which case the default is  NULL . •With an  ON UPDATE CURRENT_TIMESTAMP  clause but no  DEFAULT  clause, the column is automatically updated to the current timestamp but does not have the current timestamp for its default value. •With an  ON UPDATE CURRENT_TIMESTAMP  clause and a constant  DEFAULT  clause, the column is automatically updated to the current timestamp and has the given constant default value. With a constant, the default is the given value. In this case, the column has no automatic properties at all.