<div id="docs-body">
 <div class="chapter">
  <div class="titlepage">
   <div>
    <div>
     <h1 class="title">
      <a name="data-types">
      </a>
      Chapter 13 Data Types
     </h1>
    </div>
   </div>
  </div>
  <div class="toc">
   <p>
    <b>
     Table of Contents
    </b>
   </p>
   <dl class="toc">
    <dt>
     <span class="section">
      <a href="numeric-types.html">
       13.1 Numeric Data Types
      </a>
     </span>
    </dt>
    <dd>
     <dl>
      <dt>
       <span class="section">
        <a href="numeric-type-syntax.html">
         13.1.1 Numeric Data Type Syntax
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="integer-types.html">
         13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT,
MEDIUMINT, BIGINT
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="fixed-point-types.html">
         13.1.3 Fixed-Point Types (Exact Value) - DECIMAL, NUMERIC
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="floating-point-types.html">
         13.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="bit-type.html">
         13.1.5 Bit-Value Type - BIT
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="numeric-type-attributes.html">
         13.1.6 Numeric Type Attributes
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="out-of-range-and-overflow.html">
         13.1.7 Out-of-Range and Overflow Handling
        </a>
       </span>
      </dt>
     </dl>
    </dd>
    <dt>
     <span class="section">
      <a href="date-and-time-types.html">
       13.2 Date and Time Data Types
      </a>
     </span>
    </dt>
    <dd>
     <dl>
      <dt>
       <span class="section">
        <a href="date-and-time-type-syntax.html">
         13.2.1 Date and Time Data Type Syntax
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="datetime.html">
         13.2.2 The DATE, DATETIME, and TIMESTAMP Types
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="time.html">
         13.2.3 The TIME Type
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="year.html">
         13.2.4 The YEAR Type
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="timestamp-initialization.html">
         13.2.5 Automatic Initialization and Updating for TIMESTAMP and DATETIME
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="fractional-seconds.html">
         13.2.6 Fractional Seconds in Time Values
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="mysql-calendar.html">
         13.2.7 What Calendar Is Used By MySQL?
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="date-and-time-type-conversion.html">
         13.2.8 Conversion Between Date and Time Types
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="two-digit-years.html">
         13.2.9 2-Digit Years in Dates
        </a>
       </span>
      </dt>
     </dl>
    </dd>
    <dt>
     <span class="section">
      <a href="string-types.html">
       13.3 String Data Types
      </a>
     </span>
    </dt>
    <dd>
     <dl>
      <dt>
       <span class="section">
        <a href="string-type-syntax.html">
         13.3.1 String Data Type Syntax
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="char.html">
         13.3.2 The CHAR and VARCHAR Types
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="binary-varbinary.html">
         13.3.3 The BINARY and VARBINARY Types
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="blob.html">
         13.3.4 The BLOB and TEXT Types
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="enum.html">
         13.3.5 The ENUM Type
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="set.html">
         13.3.6 The SET Type
        </a>
       </span>
      </dt>
     </dl>
    </dd>
    <dt>
     <span class="section">
      <a href="spatial-types.html">
       13.4 Spatial Data Types
      </a>
     </span>
    </dt>
    <dd>
     <dl>
      <dt>
       <span class="section">
        <a href="spatial-type-overview.html">
         13.4.1 Spatial Data Types
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="opengis-geometry-model.html">
         13.4.2 The OpenGIS Geometry Model
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="gis-data-formats.html">
         13.4.3 Supported Spatial Data Formats
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="geometry-well-formedness-validity.html">
         13.4.4 Geometry Well-Formedness and Validity
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="spatial-reference-systems.html">
         13.4.5 Spatial Reference System Support
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="creating-spatial-columns.html">
         13.4.6 Creating Spatial Columns
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="populating-spatial-columns.html">
         13.4.7 Populating Spatial Columns
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="fetching-spatial-data.html">
         13.4.8 Fetching Spatial Data
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="optimizing-spatial-analysis.html">
         13.4.9 Optimizing Spatial Analysis
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="creating-spatial-indexes.html">
         13.4.10 Creating Spatial Indexes
        </a>
       </span>
      </dt>
      <dt>
       <span class="section">
        <a href="using-spatial-indexes.html">
         13.4.11 Using Spatial Indexes
        </a>
       </span>
      </dt>
     </dl>
    </dd>
    <dt>
     <span class="section">
      <a href="json.html">
       13.5 The JSON Data Type
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="data-type-defaults.html">
       13.6 Data Type Default Values
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="storage-requirements.html">
       13.7 Data Type Storage Requirements
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="choosing-types.html">
       13.8 Choosing the Right Type for a Column
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="other-vendor-data-types.html">
       13.9 Using Data Types from Other Database Engines
      </a>
     </span>
    </dt>
   </dl>
  </div>
  <p>
   MySQL supports
   <a class="link" href="glossary.html#glos_sql" title="SQL">
    SQL
   </a>
   data types in
    several categories: numeric types, date and time types, string
    (character and byte) types, spatial types, and the
   <a class="link" href="json.html" title="13.5 The JSON Data Type">
    <code class="literal">
     JSON
    </code>
   </a>
   data type. This chapter provides
    an overview and more detailed description of the properties of the
    types in each category, and a summary of the data type storage
    requirements. The initial overviews are intentionally brief. Consult
    the more detailed descriptions for additional information about
    particular data types, such as the permissible formats in which you
    can specify values.
  </p>
  <a class="indexterm" name="idm46045214498624">
  </a>
  <a class="indexterm" name="idm46045214497552">
  </a>
  <a class="indexterm" name="idm46045214496064">
  </a>
  <a class="indexterm" name="idm46045214494576">
  </a>
  <p>
   Data type descriptions use these conventions:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      For integer types,
      <em class="replaceable">
       <code>
        M
       </code>
      </em>
      indicates the
        maximum display width. For floating-point and fixed-point types,
      <em class="replaceable">
       <code>
        M
       </code>
      </em>
      is the total number of digits that
        can be stored (the precision). For string types,
      <em class="replaceable">
       <code>
        M
       </code>
      </em>
      is the maximum length. The maximum
        permissible value of
      <em class="replaceable">
       <code>
        M
       </code>
      </em>
      depends on the
        data type.
     </p>
     <a class="indexterm" name="idm46045214489792">
     </a>
     <a class="indexterm" name="idm46045214488720">
     </a>
     <a class="indexterm" name="idm46045214487232">
     </a>
     <a class="indexterm" name="idm46045214486160">
     </a>
     <a class="indexterm" name="idm46045214484672">
     </a>
     <a class="indexterm" name="idm46045214483600">
     </a>
    </li>
    <li class="listitem">
     <p>
      <a class="indexterm" name="idm46045214481472">
      </a>
      <a class="indexterm" name="idm46045214480400">
      </a>
      <a class="indexterm" name="idm46045214478912">
      </a>
      <a class="indexterm" name="idm46045214477840">
      </a>
      <em class="replaceable">
       <code>
        D
       </code>
      </em>
      applies to floating-point and
        fixed-point types and indicates the number of digits following
        the decimal point (the scale). The maximum possible value is 30,
        but should be no greater than
      <em class="replaceable">
       <code>
        M
       </code>
      </em>
      −2.
     </p>
    </li>
    <li class="listitem">
     <p>
      <em class="replaceable">
       <code>
        fsp
       </code>
      </em>
      applies to the
      <a class="link" href="time.html" title="13.2.3 The TIME Type">
       <code class="literal">
        TIME
       </code>
      </a>
      ,
      <a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
       <code class="literal">
        DATETIME
       </code>
      </a>
      , and
      <a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
       <code class="literal">
        TIMESTAMP
       </code>
      </a>
      types and represents
        fractional seconds precision; that is, the number of digits
        following the decimal point for fractional parts of seconds. The
      <em class="replaceable">
       <code>
        fsp
       </code>
      </em>
      value, if given, must be in the
        range 0 to 6. A value of 0 signifies that there is no fractional
        part. If omitted, the default precision is 0. (This differs from
        the standard SQL default of 6, for compatibility with previous
        MySQL versions.)
     </p>
     <a class="indexterm" name="idm46045214469808">
     </a>
     <a class="indexterm" name="idm46045214468720">
     </a>
    </li>
    <li class="listitem">
     <p>
      Square brackets (
      <code class="literal">
       [
      </code>
      and
      <code class="literal">
       ]
      </code>
      )
        indicate optional parts of type definitions.
     </p>
     <a class="indexterm" name="idm46045214464992">
     </a>
     <a class="indexterm" name="idm46045214463504">
     </a>
    </li>
   </ul>
  </div>
 </div>
 <br/>
</div>
