<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="numeric-type-syntax">
      </a>
      13.1.1 Numeric Data Type Syntax
     </h3>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045214422672">
  </a>
  <a class="indexterm" name="idm46045214421632">
  </a>
  <a class="indexterm" name="idm46045214420560">
  </a>
  <p>
   For integer data types,
   <em class="replaceable">
    <code>
     M
    </code>
   </em>
   indicates
        the minimum display width. The maximum display width is 255.
        Display width is unrelated to the range of values a type can
        store, as described in
   <a class="xref" href="numeric-type-attributes.html" title="13.1.6 Numeric Type Attributes">
    Section 13.1.6, “Numeric Type Attributes”
   </a>
   .
  </p>
  <p>
   For floating-point and fixed-point data types,
   <em class="replaceable">
    <code>
     M
    </code>
   </em>
   is the total number of digits that
        can be stored.
  </p>
  <p>
   The display width attribute is deprecated for integer data
        types; you should expect support for it to be removed in a
        future version of MySQL.
  </p>
  <p>
   If you specify
   <code class="literal">
    ZEROFILL
   </code>
   for a numeric column,
        MySQL automatically adds the
   <code class="literal">
    UNSIGNED
   </code>
   attribute to the column.
  </p>
  <p>
   The
   <code class="literal">
    ZEROFILL
   </code>
   attribute is deprecated for
        numeric data types; you should expect support for it to be
        removed in a future version of MySQL. Consider using an
        alternative means of producing the effect of this attribute. For
        example, applications could use the
   <a class="link" href="string-functions.html#function_lpad">
    <code class="literal">
     LPAD()
    </code>
   </a>
   function to zero-pad
        numbers up to the desired width, or they could store the
        formatted numbers in
   <a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
    <code class="literal">
     CHAR
    </code>
   </a>
   columns.
  </p>
  <p>
   Numeric data types that permit the
   <code class="literal">
    UNSIGNED
   </code>
   attribute also permit
   <code class="literal">
    SIGNED
   </code>
   . However, these
        data types are signed by default, so the
   <code class="literal">
    SIGNED
   </code>
   attribute has no effect.
  </p>
  <p>
   The
   <code class="literal">
    UNSIGNED
   </code>
   attribute is deprecated for
        columns of type
   <a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
    <code class="literal">
     FLOAT
    </code>
   </a>
   ,
   <a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
    <code class="literal">
     DOUBLE
    </code>
   </a>
   , and
   <a class="link" href="fixed-point-types.html" title="13.1.3 Fixed-Point Types (Exact Value) - DECIMAL, NUMERIC">
    <code class="literal">
     DECIMAL
    </code>
   </a>
   (and any synonyms); you
        should expect support for it to be removed in a future version
        of MySQL. Consider using a simple
   <code class="literal">
    CHECK
   </code>
   constraint instead for such columns.
  </p>
  <p>
   <code class="literal">
    SERIAL
   </code>
   is an alias for
   <code class="literal">
    BIGINT
        UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE
   </code>
   .
  </p>
  <p>
   <code class="literal">
    SERIAL DEFAULT VALUE
   </code>
   in the definition of an
        integer column is an alias for
   <code class="literal">
    NOT NULL AUTO_INCREMENT
        UNIQUE
   </code>
   .
  </p>
  <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Warning
   </div>
   <p>
    When you use subtraction between integer values where one is
          of type
    <code class="literal">
     UNSIGNED
    </code>
    , the result is unsigned
          unless the
    <a class="link" href="sql-mode.html#sqlmode_no_unsigned_subtraction">
     <code class="literal">
      NO_UNSIGNED_SUBTRACTION
     </code>
    </a>
    SQL
          mode is enabled. See
    <a class="xref" href="cast-functions.html" title="14.10 Cast Functions and Operators">
     Section 14.10, “Cast Functions and Operators”
    </a>
    .
   </p>
  </div>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045214392256">
      </a>
      <a class="indexterm" name="idm46045214391184">
      </a>
      <a class="link" href="bit-type.html" title="13.1.5 Bit-Value Type - BIT">
       <code class="literal">
        BIT[(
        <em class="replaceable">
         <code>
          M
         </code>
        </em>
        )]
       </code>
      </a>
     </p>
     <p>
      A bit-value type.
      <em class="replaceable">
       <code>
        M
       </code>
      </em>
      indicates the
            number of bits per value, from 1 to 64. The default is 1 if
      <em class="replaceable">
       <code>
        M
       </code>
      </em>
      is omitted.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045214383392">
      </a>
      <a class="indexterm" name="idm46045214382320">
      </a>
      <a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
       <code class="literal">
        TINYINT[(
        <em class="replaceable">
         <code>
          M
         </code>
        </em>
        )]
            [UNSIGNED] [ZEROFILL]
       </code>
      </a>
     </p>
     <p>
      A very small integer. The signed range is
      <code class="literal">
       -128
      </code>
      to
      <code class="literal">
       127
      </code>
      . The
            unsigned range is
      <code class="literal">
       0
      </code>
      to
      <code class="literal">
       255
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045214372608">
      </a>
      <a class="indexterm" name="idm46045214371536">
      </a>
      <a class="indexterm" name="idm46045214370464">
      </a>
      <a class="indexterm" name="idm46045214368976">
      </a>
      <a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
       <code class="literal">
        BOOL
       </code>
      </a>
      ,
      <a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
       <code class="literal">
        BOOLEAN
       </code>
      </a>
     </p>
     <p>
      These types are synonyms for
      <a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
       <code class="literal">
        TINYINT(1)
       </code>
      </a>
      . A value of zero
            is considered false. Nonzero values are considered true:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa67513640"><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">SELECT</span> <span class="token function">IF</span><span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span> <span class="token string">'true'</span><span class="token punctuation">,</span> <span class="token string">'false'</span><span class="token punctuation">)</span><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>
<span class="token output"><span class="token punctuation">|</span> IF(0, 'true', 'false') <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>
<span class="token output"><span class="token punctuation">|</span> false                  <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>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">IF</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token string">'true'</span><span class="token punctuation">,</span> <span class="token string">'false'</span><span class="token punctuation">)</span><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>
<span class="token output"><span class="token punctuation">|</span> IF(1, 'true', 'false') <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>
<span class="token output"><span class="token punctuation">|</span> true                   <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>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">IF</span><span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">,</span> <span class="token string">'true'</span><span class="token punctuation">,</span> <span class="token string">'false'</span><span class="token punctuation">)</span><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>
<span class="token output"><span class="token punctuation">|</span> IF(2, 'true', 'false') <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>
<span class="token output"><span class="token punctuation">|</span> true                   <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></code></pre>
     </div>
     <p>
      However, the values
      <code class="literal">
       TRUE
      </code>
      and
      <code class="literal">
       FALSE
      </code>
      are merely aliases for
      <code class="literal">
       1
      </code>
      and
      <code class="literal">
       0
      </code>
      , respectively,
            as shown here:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69388723"><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">SELECT</span> <span class="token function">IF</span><span class="token punctuation">(</span><span class="token number">0</span> <span class="token operator">=</span> <span class="token boolean">FALSE</span><span class="token punctuation">,</span> <span class="token string">'true'</span><span class="token punctuation">,</span> <span class="token string">'false'</span><span class="token punctuation">)</span><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>
<span class="token output"><span class="token punctuation">|</span> IF(0 = FALSE, 'true', 'false') <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>
<span class="token output"><span class="token punctuation">|</span> true                           <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>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">IF</span><span class="token punctuation">(</span><span class="token number">1</span> <span class="token operator">=</span> <span class="token boolean">TRUE</span><span class="token punctuation">,</span> <span class="token string">'true'</span><span class="token punctuation">,</span> <span class="token string">'false'</span><span class="token punctuation">)</span><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>
<span class="token output"><span class="token punctuation">|</span> IF(1 = TRUE, 'true', 'false') <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>
<span class="token output"><span class="token punctuation">|</span> true                          <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>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">IF</span><span class="token punctuation">(</span><span class="token number">2</span> <span class="token operator">=</span> <span class="token boolean">TRUE</span><span class="token punctuation">,</span> <span class="token string">'true'</span><span class="token punctuation">,</span> <span class="token string">'false'</span><span class="token punctuation">)</span><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>
<span class="token output"><span class="token punctuation">|</span> IF(2 = TRUE, 'true', 'false') <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>
<span class="token output"><span class="token punctuation">|</span> false                         <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>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">IF</span><span class="token punctuation">(</span><span class="token number">2</span> <span class="token operator">=</span> <span class="token boolean">FALSE</span><span class="token punctuation">,</span> <span class="token string">'true'</span><span class="token punctuation">,</span> <span class="token string">'false'</span><span class="token punctuation">)</span><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>
<span class="token output"><span class="token punctuation">|</span> IF(2 = FALSE, 'true', 'false') <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>
<span class="token output"><span class="token punctuation">|</span> false                          <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></code></pre>
     </div>
     <p>
      The last two statements display the results shown because
      <code class="literal">
       2
      </code>
      is equal to neither
      <code class="literal">
       1
      </code>
      nor
      <code class="literal">
       0
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045214345248">
      </a>
      <a class="indexterm" name="idm46045214344176">
      </a>
      <a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
       <code class="literal">
        SMALLINT[(
        <em class="replaceable">
         <code>
          M
         </code>
        </em>
        )]
            [UNSIGNED] [ZEROFILL]
       </code>
      </a>
     </p>
     <p>
      A small integer. The signed range is
      <code class="literal">
       -32768
      </code>
      to
      <code class="literal">
       32767
      </code>
      . The
            unsigned range is
      <code class="literal">
       0
      </code>
      to
      <code class="literal">
       65535
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045214334400">
      </a>
      <a class="indexterm" name="idm46045214333328">
      </a>
      <a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
       <code class="literal">
        MEDIUMINT[(
        <em class="replaceable">
         <code>
          M
         </code>
        </em>
        )]
            [UNSIGNED] [ZEROFILL]
       </code>
      </a>
     </p>
     <p>
      A medium-sized integer. The signed range is
      <code class="literal">
       -8388608
      </code>
      to
      <code class="literal">
       8388607
      </code>
      .
            The unsigned range is
      <code class="literal">
       0
      </code>
      to
      <code class="literal">
       16777215
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045214323568">
      </a>
      <a class="indexterm" name="idm46045214322496">
      </a>
      <a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
       <code class="literal">
        INT[(
        <em class="replaceable">
         <code>
          M
         </code>
        </em>
        )]
            [UNSIGNED] [ZEROFILL]
       </code>
      </a>
     </p>
     <p>
      A normal-size integer. The signed range is
      <code class="literal">
       -2147483648
      </code>
      to
      <code class="literal">
       2147483647
      </code>
      . The unsigned range is
      <code class="literal">
       0
      </code>
      to
      <code class="literal">
       4294967295
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045214313456">
      </a>
      <a class="indexterm" name="idm46045214312384">
      </a>
      <a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
       <code class="literal">
        INTEGER[(
        <em class="replaceable">
         <code>
          M
         </code>
        </em>
        )]
            [UNSIGNED] [ZEROFILL]
       </code>
      </a>
     </p>
     <p>
      This type is a synonym for
      <a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
       <code class="literal">
        INT
       </code>
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045214304272">
      </a>
      <a class="indexterm" name="idm46045214303200">
      </a>
      <a class="indexterm" name="idm46045214301712">
      </a>
      <a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
       <code class="literal">
        BIGINT[(
        <em class="replaceable">
         <code>
          M
         </code>
        </em>
        )]
            [UNSIGNED] [ZEROFILL]
       </code>
      </a>
     </p>
     <p>
      A large integer. The signed range is
      <code class="literal">
       -9223372036854775808
      </code>
      to
      <code class="literal">
       9223372036854775807
      </code>
      . The unsigned range
            is
      <code class="literal">
       0
      </code>
      to
      <code class="literal">
       18446744073709551615
      </code>
      .
     </p>
     <p>
      <code class="literal">
       SERIAL
      </code>
      is an alias for
      <code class="literal">
       BIGINT
            UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE
      </code>
      .
     </p>
     <p>
      Some things you should be aware of with respect to
      <a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
       <code class="literal">
        BIGINT
       </code>
      </a>
      columns:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         <a class="indexterm" name="idm46045214290672">
         </a>
         All arithmetic is done using signed
         <a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
          <code class="literal">
           BIGINT
          </code>
         </a>
         or
         <a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
          <code class="literal">
           DOUBLE
          </code>
         </a>
         values, so you
                should not use unsigned big integers larger than
         <code class="literal">
          9223372036854775807
         </code>
         (63 bits) except
                with bit functions! If you do that, some of the last
                digits in the result may be wrong because of rounding
                errors when converting a
         <a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
          <code class="literal">
           BIGINT
          </code>
         </a>
         value to a
         <a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
          <code class="literal">
           DOUBLE
          </code>
         </a>
         .
        </p>
        <p>
         MySQL can handle
         <a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
          <code class="literal">
           BIGINT
          </code>
         </a>
         in the following cases:
        </p>
        <div class="itemizedlist">
         <ul class="itemizedlist" style="list-style-type: square; ">
          <li class="listitem">
           <p>
            When using integers to store large unsigned values
                    in a
            <a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
             <code class="literal">
              BIGINT
             </code>
            </a>
            column.
           </p>
          </li>
          <li class="listitem">
           <p>
            In
            <a class="link" href="aggregate-functions.html#function_min">
             <code class="literal">
              MIN(
              <em class="replaceable">
               <code>
                col_name
               </code>
              </em>
              )
             </code>
            </a>
            or
            <a class="link" href="aggregate-functions.html#function_max">
             <code class="literal">
              MAX(
              <em class="replaceable">
               <code>
                col_name
               </code>
              </em>
              )
             </code>
            </a>
            ,
                    where
            <em class="replaceable">
             <code>
              col_name
             </code>
            </em>
            refers to
                    a
            <a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
             <code class="literal">
              BIGINT
             </code>
            </a>
            column.
           </p>
          </li>
          <li class="listitem">
           <p>
            When using operators
                    (
            <a class="link" href="arithmetic-functions.html#operator_plus">
             <code class="literal">
              +
             </code>
            </a>
            ,
            <a class="link" href="arithmetic-functions.html#operator_minus">
             <code class="literal">
              -
             </code>
            </a>
            ,
            <a class="link" href="arithmetic-functions.html#operator_times">
             <code class="literal">
              *
             </code>
            </a>
            ,
                    and so on) where both operands are integers.
           </p>
          </li>
         </ul>
        </div>
       </li>
       <li class="listitem">
        <p>
         You can always store an exact integer value in a
         <a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
          <code class="literal">
           BIGINT
          </code>
         </a>
         column by storing
                it using a string. In this case, MySQL performs a
                string-to-number conversion that involves no
                intermediate double-precision representation.
        </p>
       </li>
       <li class="listitem">
        <p>
         The
         <a class="link" href="arithmetic-functions.html#operator_minus">
          <code class="literal">
           -
          </code>
         </a>
         ,
         <a class="link" href="arithmetic-functions.html#operator_plus">
          <code class="literal">
           +
          </code>
         </a>
         , and
         <a class="link" href="arithmetic-functions.html#operator_times">
          <code class="literal">
           *
          </code>
         </a>
         operators use
         <a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
          <code class="literal">
           BIGINT
          </code>
         </a>
         arithmetic when both operands are integer values. This
                means that if you multiply two big integers (or results
                from functions that return integers), you may get
                unexpected results when the result is larger than
         <code class="literal">
          9223372036854775807
         </code>
         .
        </p>
       </li>
      </ul>
     </div>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045214256768">
      </a>
      <a class="indexterm" name="idm46045214255696">
      </a>
      <a class="link" href="fixed-point-types.html" title="13.1.3 Fixed-Point Types (Exact Value) - DECIMAL, NUMERIC">
       <code class="literal">
        DECIMAL[(
        <em class="replaceable">
         <code>
          M
         </code>
        </em>
        [,
        <em class="replaceable">
         <code>
          D
         </code>
        </em>
        ])]
            [UNSIGNED] [ZEROFILL]
       </code>
      </a>
     </p>
     <p>
      A packed
      <span class="quote">
       “
       <span class="quote">
        exact
       </span>
       ”
      </span>
      fixed-point number.
      <em class="replaceable">
       <code>
        M
       </code>
      </em>
      is the total number of digits
            (the precision) and
      <em class="replaceable">
       <code>
        D
       </code>
      </em>
      is the
            number of digits after the decimal point (the scale). The
            decimal point and (for negative numbers) the
      <code class="literal">
       -
      </code>
      sign are not counted in
      <em class="replaceable">
       <code>
        M
       </code>
      </em>
      . If
      <em class="replaceable">
       <code>
        D
       </code>
      </em>
      is 0, values have no decimal
            point or fractional part. The maximum number of digits
            (
      <em class="replaceable">
       <code>
        M
       </code>
      </em>
      ) for
      <a class="link" href="fixed-point-types.html" title="13.1.3 Fixed-Point Types (Exact Value) - DECIMAL, NUMERIC">
       <code class="literal">
        DECIMAL
       </code>
      </a>
      is 65. The maximum
            number of supported decimals (
      <em class="replaceable">
       <code>
        D
       </code>
      </em>
      )
            is 30. If
      <em class="replaceable">
       <code>
        D
       </code>
      </em>
      is omitted, the
            default is 0. If
      <em class="replaceable">
       <code>
        M
       </code>
      </em>
      is omitted,
            the default is 10. (There is also a limit on how long the
            text of
      <a class="link" href="fixed-point-types.html" title="13.1.3 Fixed-Point Types (Exact Value) - DECIMAL, NUMERIC">
       <code class="literal">
        DECIMAL
       </code>
      </a>
      literals can
            be; see
      <a class="xref" href="precision-math-expressions.html" title="14.24.3 Expression Handling">
       Section 14.24.3, “Expression Handling”
      </a>
      .)
     </p>
     <p>
      <code class="literal">
       UNSIGNED
      </code>
      , if specified, disallows
            negative values. The
      <code class="literal">
       UNSIGNED
      </code>
      attribute
            is deprecated for columns of type
      <a class="link" href="fixed-point-types.html" title="13.1.3 Fixed-Point Types (Exact Value) - DECIMAL, NUMERIC">
       <code class="literal">
        DECIMAL
       </code>
      </a>
      (and any synonyms);
            you should expect support for it to be removed in a future
            version of MySQL. Consider using a simple
      <code class="literal">
       CHECK
      </code>
      constraint instead for such
            columns.
     </p>
     <p>
      All basic calculations (
      <code class="literal">
       +, -, *, /
      </code>
      ) with
      <a class="link" href="fixed-point-types.html" title="13.1.3 Fixed-Point Types (Exact Value) - DECIMAL, NUMERIC">
       <code class="literal">
        DECIMAL
       </code>
      </a>
      columns are done with
            a precision of 65 digits.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045214233680">
      </a>
      <a class="indexterm" name="idm46045214232608">
      </a>
      <a class="indexterm" name="idm46045214231536">
      </a>
      <a class="indexterm" name="idm46045214230464">
      </a>
      <a class="indexterm" name="idm46045214229008">
      </a>
      <a class="indexterm" name="idm46045214227520">
      </a>
      <a class="link" href="fixed-point-types.html" title="13.1.3 Fixed-Point Types (Exact Value) - DECIMAL, NUMERIC">
       <code class="literal">
        DEC[(
        <em class="replaceable">
         <code>
          M
         </code>
        </em>
        [,
        <em class="replaceable">
         <code>
          D
         </code>
        </em>
        ])]
            [UNSIGNED] [ZEROFILL]
       </code>
      </a>
      ,
      <a class="link" href="fixed-point-types.html" title="13.1.3 Fixed-Point Types (Exact Value) - DECIMAL, NUMERIC">
       <code class="literal">
        NUMERIC[(
        <em class="replaceable">
         <code>
          M
         </code>
        </em>
        [,
        <em class="replaceable">
         <code>
          D
         </code>
        </em>
        ])]
            [UNSIGNED] [ZEROFILL]
       </code>
      </a>
      ,
      <a class="link" href="fixed-point-types.html" title="13.1.3 Fixed-Point Types (Exact Value) - DECIMAL, NUMERIC">
       <code class="literal">
        FIXED[(
        <em class="replaceable">
         <code>
          M
         </code>
        </em>
        [,
        <em class="replaceable">
         <code>
          D
         </code>
        </em>
        ])]
            [UNSIGNED] [ZEROFILL]
       </code>
      </a>
     </p>
     <p>
      These types are synonyms for
      <a class="link" href="fixed-point-types.html" title="13.1.3 Fixed-Point Types (Exact Value) - DECIMAL, NUMERIC">
       <code class="literal">
        DECIMAL
       </code>
      </a>
      . The
      <a class="link" href="fixed-point-types.html" title="13.1.3 Fixed-Point Types (Exact Value) - DECIMAL, NUMERIC">
       <code class="literal">
        FIXED
       </code>
      </a>
      synonym is available
            for compatibility with other database systems.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045214213584">
      </a>
      <a class="indexterm" name="idm46045214212512">
      </a>
      <a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
       <code class="literal">
        FLOAT[(
        <em class="replaceable">
         <code>
          M
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          D
         </code>
        </em>
        )]
            [UNSIGNED] [ZEROFILL]
       </code>
      </a>
     </p>
     <p>
      A small (single-precision) floating-point number.
            Permissible values are
      <code class="literal">
       -3.402823466E+38
      </code>
      to
      <code class="literal">
       -1.175494351E-38
      </code>
      ,
      <code class="literal">
       0
      </code>
      , and
      <code class="literal">
       1.175494351E-38
      </code>
      to
      <code class="literal">
       3.402823466E+38
      </code>
      . These are the
            theoretical limits, based on the IEEE standard. The actual
            range might be slightly smaller depending on your hardware
            or operating system.
     </p>
     <p>
      <em class="replaceable">
       <code>
        M
       </code>
      </em>
      is the total number of digits
            and
      <em class="replaceable">
       <code>
        D
       </code>
      </em>
      is the number of digits
            following the decimal point. If
      <em class="replaceable">
       <code>
        M
       </code>
      </em>
      and
      <em class="replaceable">
       <code>
        D
       </code>
      </em>
      are omitted, values are
            stored to the limits permitted by the hardware. A
            single-precision floating-point number is accurate to
            approximately 7 decimal places.
     </p>
     <p>
      <code class="literal">
       FLOAT(
       <em class="replaceable">
        <code>
         M
        </code>
       </em>
       ,
       <em class="replaceable">
        <code>
         D
        </code>
       </em>
       )
      </code>
      is a nonstandard MySQL extension. This syntax is deprecated,
            and you should expect support for it to be removed in a
            future version of MySQL.
     </p>
     <p>
      <code class="literal">
       UNSIGNED
      </code>
      , if specified, disallows
            negative values. The
      <code class="literal">
       UNSIGNED
      </code>
      attribute
            is deprecated for columns of type
      <a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
       <code class="literal">
        FLOAT
       </code>
      </a>
      (and any synonyms) and
            you should expect support for it to be removed in a future
            version of MySQL. Consider using a simple
      <code class="literal">
       CHECK
      </code>
      constraint instead for such
            columns.
     </p>
     <p>
      Using
      <a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
       <code class="literal">
        FLOAT
       </code>
      </a>
      might give you
            some unexpected problems because all calculations in MySQL
            are done with double precision. See
      <a class="xref" href="no-matching-rows.html" title="B.3.4.7 Solving Problems with No Matching Rows">
       Section B.3.4.7, “Solving Problems with No Matching Rows”
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045214192400">
      </a>
      <a class="indexterm" name="idm46045214191328">
      </a>
      <a class="indexterm" name="idm46045214190256">
      </a>
      <a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
       <code class="literal">
        FLOAT(
        <em class="replaceable">
         <code>
          p
         </code>
        </em>
        )
            [UNSIGNED] [ZEROFILL]
       </code>
      </a>
     </p>
     <p>
      A floating-point number.
      <em class="replaceable">
       <code>
        p
       </code>
      </em>
      represents the precision in bits, but MySQL uses this value
            only to determine whether to use
      <a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
       <code class="literal">
        FLOAT
       </code>
      </a>
      or
      <a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
       <code class="literal">
        DOUBLE
       </code>
      </a>
      for the resulting data
            type. If
      <em class="replaceable">
       <code>
        p
       </code>
      </em>
      is from 0 to 24, the
            data type becomes
      <a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
       <code class="literal">
        FLOAT
       </code>
      </a>
      with
            no
      <em class="replaceable">
       <code>
        M
       </code>
      </em>
      or
      <em class="replaceable">
       <code>
        D
       </code>
      </em>
      values. If
      <em class="replaceable">
       <code>
        p
       </code>
      </em>
      is from 25 to 53, the data type
            becomes
      <a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
       <code class="literal">
        DOUBLE
       </code>
      </a>
      with no
      <em class="replaceable">
       <code>
        M
       </code>
      </em>
      or
      <em class="replaceable">
       <code>
        D
       </code>
      </em>
      values. The range of the resulting column is the same as for
            the single-precision
      <a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
       <code class="literal">
        FLOAT
       </code>
      </a>
      or
            double-precision
      <a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
       <code class="literal">
        DOUBLE
       </code>
      </a>
      data
            types described earlier in this section.
     </p>
     <p>
      <code class="literal">
       UNSIGNED
      </code>
      , if specified, disallows
            negative values. The
      <code class="literal">
       UNSIGNED
      </code>
      attribute
            is deprecated for columns of type
      <a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
       <code class="literal">
        FLOAT
       </code>
      </a>
      (and any synonyms) and
            you should expect support for it to be removed in a future
            version of MySQL. Consider using a simple
      <code class="literal">
       CHECK
      </code>
      constraint instead for such
            columns.
     </p>
     <p>
      <a class="indexterm" name="idm46045214171568">
      </a>
      <a class="indexterm" name="idm46045214170496">
      </a>
      <a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
       <code class="literal">
        FLOAT(
        <em class="replaceable">
         <code>
          p
         </code>
        </em>
        )
       </code>
      </a>
      syntax is provided for ODBC compatibility.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045214164512">
      </a>
      <a class="indexterm" name="idm46045214163440">
      </a>
      <a class="indexterm" name="idm46045214162368">
      </a>
      <a class="indexterm" name="idm46045214160880">
      </a>
      <a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
       <code class="literal">
        DOUBLE[(
        <em class="replaceable">
         <code>
          M
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          D
         </code>
        </em>
        )]
            [UNSIGNED] [ZEROFILL]
       </code>
      </a>
     </p>
     <p>
      A normal-size (double-precision) floating-point number.
            Permissible values are
      <code class="literal">
       -1.7976931348623157E+308
      </code>
      to
      <code class="literal">
       -2.2250738585072014E-308
      </code>
      ,
      <code class="literal">
       0
      </code>
      , and
      <code class="literal">
       2.2250738585072014E-308
      </code>
      to
      <code class="literal">
       1.7976931348623157E+308
      </code>
      . These are the
            theoretical limits, based on the IEEE standard. The actual
            range might be slightly smaller depending on your hardware
            or operating system.
     </p>
     <p>
      <em class="replaceable">
       <code>
        M
       </code>
      </em>
      is the total number of digits
            and
      <em class="replaceable">
       <code>
        D
       </code>
      </em>
      is the number of digits
            following the decimal point. If
      <em class="replaceable">
       <code>
        M
       </code>
      </em>
      and
      <em class="replaceable">
       <code>
        D
       </code>
      </em>
      are omitted, values are
            stored to the limits permitted by the hardware. A
            double-precision floating-point number is accurate to
            approximately 15 decimal places.
     </p>
     <p>
      <code class="literal">
       DOUBLE(
       <em class="replaceable">
        <code>
         M
        </code>
       </em>
       ,
       <em class="replaceable">
        <code>
         D
        </code>
       </em>
       )
      </code>
      is a nonstandard MySQL extension; and is deprecated. You
            should expect support for this syntax to be removed in a
            future version of MySQL.
     </p>
     <p>
      <code class="literal">
       UNSIGNED
      </code>
      , if specified, disallows
            negative values. The
      <code class="literal">
       UNSIGNED
      </code>
      attribute
            is deprecated for columns of type
      <a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
       <code class="literal">
        DOUBLE
       </code>
      </a>
      (and any synonyms) and
            you should expect support for it to be removed in a future
            version of MySQL. Consider using a simple
      <code class="literal">
       CHECK
      </code>
      constraint instead for such
            columns.
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045214142016">
      </a>
      <a class="indexterm" name="idm46045214140928">
      </a>
      <a class="indexterm" name="idm46045214139856">
      </a>
      <a class="indexterm" name="idm46045214138368">
      </a>
      <a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
       <code class="literal">
        DOUBLE
            PRECISION[(
        <em class="replaceable">
         <code>
          M
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          D
         </code>
        </em>
        )]
            [UNSIGNED] [ZEROFILL]
       </code>
      </a>
      ,
      <a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
       <code class="literal">
        REAL[(
        <em class="replaceable">
         <code>
          M
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          D
         </code>
        </em>
        )]
            [UNSIGNED] [ZEROFILL]
       </code>
      </a>
     </p>
     <p>
      These types are synonyms for
      <a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
       <code class="literal">
        DOUBLE
       </code>
      </a>
      . Exception: If the
      <a class="link" href="sql-mode.html#sqlmode_real_as_float">
       <code class="literal">
        REAL_AS_FLOAT
       </code>
      </a>
      SQL mode is
            enabled,
      <a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
       <code class="literal">
        REAL
       </code>
      </a>
      is a synonym
            for
      <a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
       <code class="literal">
        FLOAT
       </code>
      </a>
      rather than
      <a class="link" href="floating-point-types.html" title="13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE">
       <code class="literal">
        DOUBLE
       </code>
      </a>
      .
     </p>
    </li>
   </ul>
  </div>
 </div>
 <br/>
</div>
