<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h2 class="title">
      <a name="data-type-defaults">
      </a>
      13.6 Data Type Default Values
     </h2>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045210878688">
  </a>
  <a class="indexterm" name="idm46045210877648">
  </a>
  <a class="indexterm" name="idm46045210876160">
  </a>
  <a class="indexterm" name="idm46045210875088">
  </a>
  <a class="indexterm" name="idm46045210873600">
  </a>
  <a class="indexterm" name="idm46045210872528">
  </a>
  <p>
   Data type specifications can have explicit or implicit default
      values.
  </p>
  <p>
   A
   <code class="literal">
    DEFAULT
    <em class="replaceable">
     <code>
      value
     </code>
    </em>
   </code>
   clause in a data type specification explicitly indicates a default
      value for a column. Examples:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa73887269"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>
  i     <span class="token datatype">INT</span> <span class="token keyword">DEFAULT</span> <span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">,</span>
  c     <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">)</span> <span class="token keyword">DEFAULT</span> <span class="token string">''</span><span class="token punctuation">,</span>
  price <span class="token datatype">DOUBLE</span><span class="token punctuation">(</span><span class="token number">16</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">)</span> <span class="token keyword">DEFAULT</span> <span class="token number">0.00</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
  </div>
  <a class="indexterm" name="idm46045210868416">
  </a>
  <p>
   <code class="literal">
    SERIAL DEFAULT VALUE
   </code>
   is a special case. In the
      definition of an integer column, it is an alias for
   <code class="literal">
    NOT
      NULL AUTO_INCREMENT UNIQUE
   </code>
   .
  </p>
  <p>
   Some aspects of explicit
   <code class="literal">
    DEFAULT
   </code>
   clause
      handling are version dependent, as described following.
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="xref" href="data-type-defaults.html#data-type-defaults-explicit" title="Explicit Default Handling">
       Explicit Default Handling
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="data-type-defaults.html#data-type-defaults-implicit" title="Implicit Default Handling">
       Implicit Default Handling
      </a>
     </p>
    </li>
   </ul>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h3 class="title">
       <a name="data-type-defaults-explicit">
       </a>
       Explicit Default Handling
      </h3>
     </div>
    </div>
   </div>
   <p>
    The default value specified in a
    <code class="literal">
     DEFAULT
    </code>
    clause can be a literal constant or an expression. With one
        exception, enclose expression default values within parentheses
        to distinguish them from literal constant default values.
        Examples:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa46658563"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>
  <span class="token comment" spellcheck="true">-- literal defaults</span>
  i <span class="token datatype">INT</span>         <span class="token keyword">DEFAULT</span> <span class="token number">0</span><span class="token punctuation">,</span>
  c <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">)</span> <span class="token keyword">DEFAULT</span> <span class="token string">''</span><span class="token punctuation">,</span>
  <span class="token comment" spellcheck="true">-- expression defaults</span>
  f <span class="token datatype">FLOAT</span>       <span class="token function">DEFAULT</span> <span class="token punctuation">(</span><span class="token function">RAND</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">*</span> <span class="token function">RAND</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
  b <span class="token datatype">BINARY</span><span class="token punctuation">(</span><span class="token number">16</span><span class="token punctuation">)</span>  <span class="token function">DEFAULT</span> <span class="token punctuation">(</span><span class="token function">UUID_TO_BIN</span><span class="token punctuation">(</span><span class="token function">UUID</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
  d <span class="token datatype">DATE</span>        <span class="token function">DEFAULT</span> <span class="token punctuation">(</span><span class="token keyword">CURRENT_DATE</span> <span class="token operator">+</span> <span class="token keyword">INTERVAL</span> <span class="token number">1</span> <span class="token datatype">YEAR</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
  p <span class="token keyword">POINT</span>       <span class="token function">DEFAULT</span> <span class="token punctuation">(</span><span class="token function">Point</span><span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
  j <span class="token datatype">JSON</span>        <span class="token function">DEFAULT</span> <span class="token punctuation">(</span><span class="token function">JSON_ARRAY</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
   </div>
   <p>
    The exception is that, for
    <a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
     <code class="literal">
      TIMESTAMP
     </code>
    </a>
    and
    <a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
     <code class="literal">
      DATETIME
     </code>
    </a>
    columns, you can specify
        the
    <a class="link" href="date-and-time-functions.html#function_current-timestamp">
     <code class="literal">
      CURRENT_TIMESTAMP
     </code>
    </a>
    function as
        the default, without enclosing parentheses. See
    <a class="xref" href="timestamp-initialization.html" title="13.2.5 Automatic Initialization and Updating for TIMESTAMP and DATETIME">
     Section 13.2.5, “Automatic Initialization and Updating for TIMESTAMP and DATETIME”
    </a>
    .
   </p>
   <p>
    The
    <a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
     <code class="literal">
      BLOB
     </code>
    </a>
    ,
    <a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
     <code class="literal">
      TEXT
     </code>
    </a>
    ,
    <code class="literal">
     GEOMETRY
    </code>
    , and
    <a class="link" href="json.html" title="13.5 The JSON Data Type">
     <code class="literal">
      JSON
     </code>
    </a>
    data types can be assigned a
        default value only if the value is written as an expression,
        even if the expression value is a literal:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       This is permitted (literal default specified as expression):
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa46843920"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t2 <span class="token punctuation">(</span>b <span class="token datatype">BLOB</span> <span class="token function">DEFAULT</span> <span class="token punctuation">(</span><span class="token string">'abc'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       This produces an error (literal default not specified as
            expression):
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa67057415"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t2 <span class="token punctuation">(</span>b <span class="token datatype">BLOB</span> <span class="token keyword">DEFAULT</span> <span class="token string">'abc'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
      </div>
     </li>
    </ul>
   </div>
   <p>
    Expression default values must adhere to the following rules. An
        error occurs if an expression contains disallowed constructs.
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       Literals, built-in functions (both deterministic and
            nondeterministic), and operators are permitted.
      </p>
     </li>
     <li class="listitem">
      <p>
       Subqueries, parameters, variables, stored functions, and
            loadable functions are not permitted.
      </p>
     </li>
     <li class="listitem">
      <p>
       An expression default value cannot depend on a column that
            has the
       <code class="literal">
        AUTO_INCREMENT
       </code>
       attribute.
      </p>
     </li>
     <li class="listitem">
      <p>
       An expression default value for one column can refer to
            other table columns, with the exception that references to
            generated columns or columns with expression default values
            must be to columns that occur earlier in the table
            definition. That is, expression default values cannot
            contain forward references to generated columns or columns
            with expression default values.
      </p>
      <p>
       The ordering constraint also applies to the use of
       <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
        <code class="literal">
         ALTER TABLE
        </code>
       </a>
       to reorder table
            columns. If the resulting table would have an expression
            default value that contains a forward reference to a
            generated column or column with an expression default value,
            the statement fails.
      </p>
     </li>
    </ul>
   </div>
   <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
    <div class="admon-title">
     Note
    </div>
    <p>
     If any component of an expression default value depends on the
          SQL mode, different results may occur for different uses of
          the table unless the SQL mode is the same during all uses.
    </p>
   </div>
   <p>
    For
    <a class="link" href="create-table-like.html" title="15.1.20.3 CREATE TABLE ... LIKE Statement">
     <code class="literal">
      CREATE
        TABLE ... LIKE
     </code>
    </a>
    and
    <a class="link" href="create-table-select.html" title="15.1.20.4 CREATE TABLE ... SELECT Statement">
     <code class="literal">
      CREATE
        TABLE ... SELECT
     </code>
    </a>
    , the destination table preserves
        expression default values from the original table.
   </p>
   <p>
    If an expression default value refers to a nondeterministic
        function, any statement that causes the expression to be
        evaluated is unsafe for statement-based replication. This
        includes statements such as
    <a class="link" href="insert.html" title="15.2.7 INSERT Statement">
     <code class="literal">
      INSERT
     </code>
    </a>
    and
    <a class="link" href="update.html" title="15.2.17 UPDATE Statement">
     <code class="literal">
      UPDATE
     </code>
    </a>
    . In this situation, if
        binary logging is disabled, the statement is executed as normal.
        If binary logging is enabled and
    <a class="link" href="replication-options-binary-log.html#sysvar_binlog_format">
     <code class="literal">
      binlog_format
     </code>
    </a>
    is set to
    <code class="literal">
     STATEMENT
    </code>
    , the statement is logged and
        executed but a warning message is written to the error log,
        because replicas might diverge. When
    <a class="link" href="replication-options-binary-log.html#sysvar_binlog_format">
     <code class="literal">
      binlog_format
     </code>
    </a>
    is set to
    <code class="literal">
     MIXED
    </code>
    or
    <code class="literal">
     ROW
    </code>
    , the
        statement is executed as normal.
   </p>
   <p>
    When inserting a new row, the default value for a column with an
        expression default can be inserted either by omitting the column
        name or by specifying the column as
    <code class="literal">
     DEFAULT
    </code>
    (just as for columns with literal defaults):
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa51605933"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t4 <span class="token punctuation">(</span>uid <span class="token datatype">BINARY</span><span class="token punctuation">(</span><span class="token number">16</span><span class="token punctuation">)</span> <span class="token function">DEFAULT</span> <span class="token punctuation">(</span><span class="token function">UUID_TO_BIN</span><span class="token punctuation">(</span><span class="token function">UUID</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t4 <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t4 <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token keyword">DEFAULT</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">BIN_TO_UUID</span><span class="token punctuation">(</span>uid<span class="token punctuation">)</span> <span class="token keyword">AS</span> uid <span class="token keyword">FROM</span> t4<span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> uid                                  <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> f1109174<span class="token punctuation">-</span>94c9<span class="token punctuation">-</span>11e8<span class="token punctuation">-</span>971d<span class="token punctuation">-</span>3bf1095aa633 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> f110cf9a<span class="token punctuation">-</span>94c9<span class="token punctuation">-</span>11e8<span class="token punctuation">-</span>971d<span class="token punctuation">-</span>3bf1095aa633 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
   </div>
   <p>
    However, the use of
    <a class="link" href="miscellaneous-functions.html#function_default">
     <code class="literal">
      DEFAULT(
      <em class="replaceable">
       <code>
        col_name
       </code>
      </em>
      )
     </code>
    </a>
    to specify the default value for a named column is permitted
        only for columns that have a literal default value, not for
        columns that have an expression default value.
   </p>
   <p>
    Not all storage engines permit expression default values. For
        those that do not, an
    <a class="ulink" href="/doc/mysql-errors/8.4/en/server-error-reference.html#error_er_unsupported_action_on_default_val_generated" target="_top">
     <code class="literal">
      ER_UNSUPPORTED_ACTION_ON_DEFAULT_VAL_GENERATED
     </code>
    </a>
    error occurs.
   </p>
   <p>
    If a default value evaluates to a data type that differs from
        the declared column type, implicit coercion to the declared type
        occurs according to the usual MySQL type-conversion rules. See
    <a class="xref" href="type-conversion.html" title="14.3 Type Conversion in Expression Evaluation">
     Section 14.3, “Type Conversion in Expression Evaluation”
    </a>
    .
   </p>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h3 class="title">
       <a name="data-type-defaults-implicit">
       </a>
       Implicit Default Handling
      </h3>
     </div>
    </div>
   </div>
   <p>
    If a data type specification includes no explicit
    <code class="literal">
     DEFAULT
    </code>
    value, MySQL determines the default
        value as follows:
   </p>
   <p>
    If the column can take
    <code class="literal">
     NULL
    </code>
    as a value, the
        column is defined with an explicit
    <code class="literal">
     DEFAULT
        NULL
    </code>
    clause.
   </p>
   <p>
    If the column cannot take
    <code class="literal">
     NULL
    </code>
    as a value,
        MySQL defines the column with no explicit
    <code class="literal">
     DEFAULT
    </code>
    clause.
   </p>
   <p>
    For data entry into a
    <code class="literal">
     NOT NULL
    </code>
    column that
        has no explicit
    <code class="literal">
     DEFAULT
    </code>
    clause, if an
    <a class="link" href="insert.html" title="15.2.7 INSERT Statement">
     <code class="literal">
      INSERT
     </code>
    </a>
    or
    <a class="link" href="replace.html" title="15.2.12 REPLACE Statement">
     <code class="literal">
      REPLACE
     </code>
    </a>
    statement includes no
        value for the column, or an
    <a class="link" href="update.html" title="15.2.17 UPDATE Statement">
     <code class="literal">
      UPDATE
     </code>
    </a>
    statement sets the column
        to
    <code class="literal">
     NULL
    </code>
    , MySQL handles the column according
        to the SQL mode in effect at the time:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       If strict SQL mode is enabled, an error occurs for
            transactional tables and the statement is rolled back. For
            nontransactional tables, an error occurs, but if this
            happens for the second or subsequent row of a multiple-row
            statement, the preceding rows are inserted.
      </p>
     </li>
     <li class="listitem">
      <p>
       If strict mode is not enabled, MySQL sets the column to the
            implicit default value for the column data type.
      </p>
     </li>
    </ul>
   </div>
   <p>
    Suppose that a table
    <code class="literal">
     t
    </code>
    is defined as follows:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa27376419"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t <span class="token punctuation">(</span>i <span class="token datatype">INT</span> <span class="token operator">NOT</span> <span class="token boolean">NULL</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
   </div>
   <p>
    In this case,
    <code class="literal">
     i
    </code>
    has no explicit default, so
        in strict mode each of the following statements produce an error
        and no row is inserted. When not using strict mode, only the
        third statement produces an error; the implicit default is
        inserted for the first two statements, but the third fails
        because
    <a class="link" href="miscellaneous-functions.html#function_default">
     <code class="literal">
      DEFAULT(i)
     </code>
    </a>
    cannot produce
        a value:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa267408"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token keyword">DEFAULT</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> t <span class="token keyword">VALUES</span><span class="token punctuation">(</span><span class="token function">DEFAULT</span><span class="token punctuation">(</span>i<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
   </div>
   <p>
    See
    <a class="xref" href="sql-mode.html" title="7.1.11 Server SQL Modes">
     Section 7.1.11, “Server SQL Modes”
    </a>
    .
   </p>
   <p>
    For a given table, the
    <a class="link" href="show-create-table.html" title="15.7.7.11 SHOW CREATE TABLE Statement">
     <code class="literal">
      SHOW CREATE
        TABLE
     </code>
    </a>
    statement displays which columns have an
        explicit
    <code class="literal">
     DEFAULT
    </code>
    clause.
   </p>
   <p>
    Implicit defaults are defined as follows:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       For numeric types, the default is
       <code class="literal">
        0
       </code>
       , with
            the exception that for integer or floating-point types
            declared with the
       <code class="literal">
        AUTO_INCREMENT
       </code>
       attribute, the default is the next value in the sequence.
      </p>
     </li>
     <li class="listitem">
      <p>
       For date and time types other than
       <a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
        <code class="literal">
         TIMESTAMP
        </code>
       </a>
       , the default is the
            appropriate
       <span class="quote">
        “
        <span class="quote">
         zero
        </span>
        ”
       </span>
       value for the type. This is
            also true for
       <a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
        <code class="literal">
         TIMESTAMP
        </code>
       </a>
       if
            the
       <a class="link" href="server-system-variables.html#sysvar_explicit_defaults_for_timestamp">
        <code class="literal">
         explicit_defaults_for_timestamp
        </code>
       </a>
       system variable is enabled (see
       <a class="xref" href="server-system-variables.html" title="7.1.8 Server System Variables">
        Section 7.1.8, “Server System Variables”
       </a>
       ). Otherwise, for
            the first
       <a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
        <code class="literal">
         TIMESTAMP
        </code>
       </a>
       column in
            a table, the default value is the current date and time. See
       <a class="xref" href="date-and-time-types.html" title="13.2 Date and Time Data Types">
        Section 13.2, “Date and Time Data Types”
       </a>
       .
      </p>
     </li>
     <li class="listitem">
      <p>
       For string types other than
       <a class="link" href="enum.html" title="13.3.5 The ENUM Type">
        <code class="literal">
         ENUM
        </code>
       </a>
       , the default value is
            the empty string. For
       <a class="link" href="enum.html" title="13.3.5 The ENUM Type">
        <code class="literal">
         ENUM
        </code>
       </a>
       ,
            the default is the first enumeration value.
      </p>
     </li>
    </ul>
   </div>
  </div>
 </div>
 <br/>
</div>
