<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h2 class="title">
      <a name="miscellaneous-functions">
      </a>
      14.23 Miscellaneous Functions
     </h2>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045191203456">
  </a>
  <a class="indexterm" name="idm46045191202384">
  </a>
  <div class="table">
   <a name="idm46045191200896">
   </a>
   <p class="title">
    <b>
     Table 14.33 Miscellaneous Functions
    </b>
   </p>
   <div class="table-contents">
    <table frame="box" rules="all" summary="A reference that lists miscellaneous functions.">
     <colgroup>
      <col style="width: 28%"/>
      <col style="width: 71%"/>
     </colgroup>
     <thead>
      <tr>
       <th>
        Name
       </th>
       <th>
        Description
       </th>
      </tr>
     </thead>
     <tbody>
      <tr>
       <td>
        <a class="link" href="miscellaneous-functions.html#function_any-value">
         <code class="literal">
          ANY_VALUE()
         </code>
        </a>
       </td>
       <td>
        Suppress ONLY_FULL_GROUP_BY value rejection
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="miscellaneous-functions.html#function_bin-to-uuid">
         <code class="literal">
          BIN_TO_UUID()
         </code>
        </a>
       </td>
       <td>
        Convert binary UUID to string
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="miscellaneous-functions.html#function_default">
         <code class="literal">
          DEFAULT()
         </code>
        </a>
       </td>
       <td>
        Return the default value for a table column
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="miscellaneous-functions.html#function_grouping">
         <code class="literal">
          GROUPING()
         </code>
        </a>
       </td>
       <td>
        Distinguish super-aggregate ROLLUP rows from regular rows
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="miscellaneous-functions.html#function_inet-aton">
         <code class="literal">
          INET_ATON()
         </code>
        </a>
       </td>
       <td>
        Return the numeric value of an IP address
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="miscellaneous-functions.html#function_inet-ntoa">
         <code class="literal">
          INET_NTOA()
         </code>
        </a>
       </td>
       <td>
        Return the IP address from a numeric value
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="miscellaneous-functions.html#function_is-uuid">
         <code class="literal">
          IS_UUID()
         </code>
        </a>
       </td>
       <td>
        Whether argument is a valid UUID
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="miscellaneous-functions.html#function_name-const">
         <code class="literal">
          NAME_CONST()
         </code>
        </a>
       </td>
       <td>
        Cause the column to have the given name
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="miscellaneous-functions.html#function_sleep">
         <code class="literal">
          SLEEP()
         </code>
        </a>
       </td>
       <td>
        Sleep for a number of seconds
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="miscellaneous-functions.html#function_uuid">
         <code class="literal">
          UUID()
         </code>
        </a>
       </td>
       <td>
        Return a Universal Unique Identifier (UUID)
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="miscellaneous-functions.html#function_uuid-short">
         <code class="literal">
          UUID_SHORT()
         </code>
        </a>
       </td>
       <td>
        Return an integer-valued universal identifier
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="miscellaneous-functions.html#function_uuid-to-bin">
         <code class="literal">
          UUID_TO_BIN()
         </code>
        </a>
       </td>
       <td>
        Convert string UUID to binary
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="miscellaneous-functions.html#function_values">
         <code class="literal">
          VALUES()
         </code>
        </a>
       </td>
       <td>
        Define the values to be used during an INSERT
       </td>
      </tr>
     </tbody>
    </table>
   </div>
   <div class="table-contents">
    <table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 401px; width: 548px;">
     <thead>
      <tr>
       <th style="width: 154.641px;">
        Name
       </th>
       <th style="width: 392.156px;">
        Description
       </th>
      </tr>
     </thead>
    </table>
   </div>
  </div>
  <br class="table-break"/>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <a name="function_any-value">
     </a>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_any-value">
       <code class="literal">
        ANY_VALUE(
        <em class="replaceable">
         <code>
          arg
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045191150304">
     </a>
     <p>
      This function is useful for
      <code class="literal">
       GROUP BY
      </code>
      queries when the
      <a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
       <code class="literal">
        ONLY_FULL_GROUP_BY
       </code>
      </a>
      SQL mode
          is enabled, for cases when MySQL rejects a query that you know
          is valid for reasons that MySQL cannot determine. The function
          return value and type are the same as the return value and
          type of its argument, but the function result is not checked
          for the
      <a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
       <code class="literal">
        ONLY_FULL_GROUP_BY
       </code>
      </a>
      SQL mode.
     </p>
     <p>
      For example, if
      <code class="literal">
       name
      </code>
      is a nonindexed
          column, the following query fails with
      <a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
       <code class="literal">
        ONLY_FULL_GROUP_BY
       </code>
      </a>
      enabled:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa42373204"><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 keyword">name</span><span class="token punctuation">,</span> address<span class="token punctuation">,</span> <span class="token function">MAX</span><span class="token punctuation">(</span>age<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">name</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1055 (42000)<span class="token punctuation">:</span> Expression #2 of SELECT list is not in GROUP
BY clause and contains nonaggregated column 'mydb.t.address' which
is not functionally dependent on columns in GROUP BY clause; this
is incompatible with sql_mode=only_full_group_by</span></code></pre>
     </div>
     <p>
      The failure occurs because
      <code class="literal">
       address
      </code>
      is a
          nonaggregated column that is neither named among
      <code class="literal">
       GROUP BY
      </code>
      columns nor functionally dependent
          on them. As a result, the
      <code class="literal">
       address
      </code>
      value for
          rows within each
      <code class="literal">
       name
      </code>
      group is
          nondeterministic. There are multiple ways to cause MySQL to
          accept the query:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         Alter the table to make
         <code class="literal">
          name
         </code>
         a primary
              key or a unique
         <code class="literal">
          NOT NULL
         </code>
         column. This
              enables MySQL to determine that
         <code class="literal">
          address
         </code>
         is functionally dependent on
         <code class="literal">
          name
         </code>
         ; that
              is,
         <code class="literal">
          address
         </code>
         is uniquely determined by
         <code class="literal">
          name
         </code>
         . (This technique is inapplicable
              if
         <code class="literal">
          NULL
         </code>
         must be permitted as a valid
         <code class="literal">
          name
         </code>
         value.)
        </p>
       </li>
       <li class="listitem">
        <p>
         Use
         <a class="link" href="miscellaneous-functions.html#function_any-value">
          <code class="literal">
           ANY_VALUE()
          </code>
         </a>
         to refer to
         <code class="literal">
          address
         </code>
         :
        </p>
        <div class="copytoclipboard-wrapper">
         <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa81425803"><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">SELECT</span> <span class="token keyword">name</span><span class="token punctuation">,</span> <span class="token function">ANY_VALUE</span><span class="token punctuation">(</span>address<span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">MAX</span><span class="token punctuation">(</span>age<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">name</span><span class="token punctuation">;</span></code></pre>
        </div>
        <p>
         In this case, MySQL ignores the nondeterminism of
         <code class="literal">
          address
         </code>
         values within each
         <code class="literal">
          name
         </code>
         group and accepts the query. This
              may be useful if you simply do not care which value of a
              nonaggregated column is chosen for each group.
         <a class="link" href="miscellaneous-functions.html#function_any-value">
          <code class="literal">
           ANY_VALUE()
          </code>
         </a>
         is not an
              aggregate function, unlike functions such as
         <a class="link" href="aggregate-functions.html#function_sum">
          <code class="literal">
           SUM()
          </code>
         </a>
         or
         <a class="link" href="aggregate-functions.html#function_count">
          <code class="literal">
           COUNT()
          </code>
         </a>
         . It simply acts to
              suppress the test for nondeterminism.
        </p>
       </li>
       <li class="listitem">
        <p>
         Disable
         <a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
          <code class="literal">
           ONLY_FULL_GROUP_BY
          </code>
         </a>
         . This
              is equivalent to using
         <a class="link" href="miscellaneous-functions.html#function_any-value">
          <code class="literal">
           ANY_VALUE()
          </code>
         </a>
         with
         <a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
          <code class="literal">
           ONLY_FULL_GROUP_BY
          </code>
         </a>
         enabled, as described in the previous item.
        </p>
       </li>
      </ul>
     </div>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_any-value">
       <code class="literal">
        ANY_VALUE()
       </code>
      </a>
      is also useful if
          functional dependence exists between columns but MySQL cannot
          determine it. The following query is valid because
      <code class="literal">
       age
      </code>
      is functionally dependent on the
          grouping column
      <code class="literal">
       age-1
      </code>
      , but MySQL cannot
          tell that and rejects the query with
      <a class="link" href="sql-mode.html#sqlmode_only_full_group_by">
       <code class="literal">
        ONLY_FULL_GROUP_BY
       </code>
      </a>
      enabled:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa97202460"><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">SELECT</span> age <span class="token keyword">FROM</span> t <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> age<span class="token number">-1</span><span class="token punctuation">;</span></code></pre>
     </div>
     <p>
      To cause MySQL to accept the query, use
      <a class="link" href="miscellaneous-functions.html#function_any-value">
       <code class="literal">
        ANY_VALUE()
       </code>
      </a>
      :
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa31369525"><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">SELECT</span> <span class="token function">ANY_VALUE</span><span class="token punctuation">(</span>age<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> age<span class="token number">-1</span><span class="token punctuation">;</span></code></pre>
     </div>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_any-value">
       <code class="literal">
        ANY_VALUE()
       </code>
      </a>
      can be used for
          queries that refer to aggregate functions in the absence of a
      <code class="literal">
       GROUP BY
      </code>
      clause:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa37450731"><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 keyword">name</span><span class="token punctuation">,</span> <span class="token function">MAX</span><span class="token punctuation">(</span>age<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t<span class="token punctuation">;</span>
<span class="token output">ERROR 1140 (42000)<span class="token punctuation">:</span> In aggregated query without GROUP BY, expression
#1 of SELECT list contains nonaggregated column 'mydb.t.name'; this
is incompatible with sql_mode=only_full_group_by</span></code></pre>
     </div>
     <p>
      Without
      <code class="literal">
       GROUP BY
      </code>
      , there is a single group
          and it is nondeterministic which
      <code class="literal">
       name
      </code>
      value
          to choose for the group.
      <a class="link" href="miscellaneous-functions.html#function_any-value">
       <code class="literal">
        ANY_VALUE()
       </code>
      </a>
      tells MySQL to
          accept the query:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa55694789"><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">SELECT</span> <span class="token function">ANY_VALUE</span><span class="token punctuation">(</span><span class="token keyword">name</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">MAX</span><span class="token punctuation">(</span>age<span class="token punctuation">)</span> <span class="token keyword">FROM</span> t<span class="token punctuation">;</span></code></pre>
     </div>
     <p>
      It may be that, due to some property of a given data set, you
          know that a selected nonaggregated column is effectively
          functionally dependent on a
      <code class="literal">
       GROUP BY
      </code>
      column. For example, an application may enforce uniqueness of
          one column with respect to another. In this case, using
      <a class="link" href="miscellaneous-functions.html#function_any-value">
       <code class="literal">
        ANY_VALUE()
       </code>
      </a>
      for the effectively
          functionally dependent column may make sense.
     </p>
     <p>
      For additional discussion, see
      <a class="xref" href="group-by-handling.html" title="14.19.3 MySQL Handling of GROUP BY">
       Section 14.19.3, “MySQL Handling of GROUP BY”
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <a name="function_bin-to-uuid">
     </a>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_bin-to-uuid">
       <code class="literal">
        BIN_TO_UUID(
        <em class="replaceable">
         <code>
          binary_uuid
         </code>
        </em>
        )
       </code>
      </a>
      ,
      <a class="link" href="miscellaneous-functions.html#function_bin-to-uuid">
       <code class="literal">
        BIN_TO_UUID(
        <em class="replaceable">
         <code>
          binary_uuid
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          swap_flag
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045191087872">
     </a>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_bin-to-uuid">
       <code class="literal">
        BIN_TO_UUID()
       </code>
      </a>
      is the inverse of
      <a class="link" href="miscellaneous-functions.html#function_uuid-to-bin">
       <code class="literal">
        UUID_TO_BIN()
       </code>
      </a>
      . It converts a
          binary UUID to a string UUID and returns the result. The
          binary value should be a UUID as a
      <a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
       <code class="literal">
        VARBINARY(16)
       </code>
      </a>
      value. The return
          value is a string of five hexadecimal numbers separated by
          dashes. (For details about this format, see the
      <a class="link" href="miscellaneous-functions.html#function_uuid">
       <code class="literal">
        UUID()
       </code>
      </a>
      function description.)
          If the UUID argument is
      <code class="literal">
       NULL
      </code>
      , the return
          value is
      <code class="literal">
       NULL
      </code>
      . If any argument is invalid,
          an error occurs.
     </p>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_bin-to-uuid">
       <code class="literal">
        BIN_TO_UUID()
       </code>
      </a>
      takes one or two
          arguments:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         The one-argument form takes a binary UUID value. The UUID
              value is assumed not to have its time-low and time-high
              parts swapped. The string result is in the same order as
              the binary argument.
        </p>
       </li>
       <li class="listitem">
        <p>
         The two-argument form takes a binary UUID value and a
              swap-flag value:
        </p>
        <div class="itemizedlist">
         <ul class="itemizedlist" style="list-style-type: square; ">
          <li class="listitem">
           <p>
            If
            <em class="replaceable">
             <code>
              swap_flag
             </code>
            </em>
            is 0, the
                  two-argument form is equivalent to the one-argument
                  form. The string result is in the same order as the
                  binary argument.
           </p>
          </li>
          <li class="listitem">
           <p>
            If
            <em class="replaceable">
             <code>
              swap_flag
             </code>
            </em>
            is 1, the UUID
                  value is assumed to have its time-low and time-high
                  parts swapped. These parts are swapped back to their
                  original position in the result value.
           </p>
          </li>
         </ul>
        </div>
       </li>
      </ul>
     </div>
     <p>
      For usage examples and information about time-part swapping,
          see the
      <a class="link" href="miscellaneous-functions.html#function_uuid-to-bin">
       <code class="literal">
        UUID_TO_BIN()
       </code>
      </a>
      function
          description.
     </p>
    </li>
    <li class="listitem">
     <a name="function_default">
     </a>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_default">
       <code class="literal">
        DEFAULT(
        <em class="replaceable">
         <code>
          col_name
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045191065328">
     </a>
     <p>
      Returns the default value for a table column. An error results
          if the column has no default value.
     </p>
     <p>
      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>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa53730838"><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">UPDATE</span> t <span class="token keyword">SET</span> i <span class="token operator">=</span> <span class="token function">DEFAULT</span><span class="token punctuation">(</span>i<span class="token punctuation">)</span><span class="token operator">+</span><span class="token number">1</span> <span class="token keyword">WHERE</span> id <span class="token operator">&lt;</span> <span class="token number">100</span><span class="token punctuation">;</span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <p>
      <a class="link" href="string-functions.html#function_format">
       <code class="literal">
        FORMAT(
        <em class="replaceable">
         <code>
          X
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          D
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <p>
      Formats the number
      <em class="replaceable">
       <code>
        X
       </code>
      </em>
      to a format
          like
      <code class="literal">
       '#,###,###.##'
      </code>
      , rounded to
      <em class="replaceable">
       <code>
        D
       </code>
      </em>
      decimal places, and returns the
          result as a string. For details, see
      <a class="xref" href="string-functions.html" title="14.8 String Functions and Operators">
       Section 14.8, “String Functions and Operators”
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <a name="function_grouping">
     </a>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_grouping">
       <code class="literal">
        GROUPING(
        <em class="replaceable">
         <code>
          expr
         </code>
        </em>
        [,
        <em class="replaceable">
         <code>
          expr
         </code>
        </em>
        ] ...)
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045191046032">
     </a>
     <p>
      For
      <code class="literal">
       GROUP BY
      </code>
      queries that include a
      <code class="literal">
       WITH ROLLUP
      </code>
      modifier, the
      <code class="literal">
       ROLLUP
      </code>
      operation produces super-aggregate
          output rows where
      <code class="literal">
       NULL
      </code>
      represents the set
          of all values. The
      <a class="link" href="miscellaneous-functions.html#function_grouping">
       <code class="literal">
        GROUPING()
       </code>
      </a>
      function enables you to distinguish
      <code class="literal">
       NULL
      </code>
      values for super-aggregate rows from
      <code class="literal">
       NULL
      </code>
      values in regular grouped rows.
     </p>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_grouping">
       <code class="literal">
        GROUPING()
       </code>
      </a>
      is permitted in the
          select list,
      <code class="literal">
       HAVING
      </code>
      clause, and
      <code class="literal">
       ORDER BY
      </code>
      clause.
     </p>
     <p>
      Each argument to
      <a class="link" href="miscellaneous-functions.html#function_grouping">
       <code class="literal">
        GROUPING()
       </code>
      </a>
      must be an expression that exactly matches an expression in
          the
      <code class="literal">
       GROUP BY
      </code>
      clause. The expression cannot
          be a positional specifier. For each expression,
      <a class="link" href="miscellaneous-functions.html#function_grouping">
       <code class="literal">
        GROUPING()
       </code>
      </a>
      produces 1 if the
          expression value in the current row is a
      <code class="literal">
       NULL
      </code>
      representing a super-aggregate value.
          Otherwise,
      <a class="link" href="miscellaneous-functions.html#function_grouping">
       <code class="literal">
        GROUPING()
       </code>
      </a>
      produces
          0, indicating that the expression value is a
      <code class="literal">
       NULL
      </code>
      for a regular result row or is not
      <code class="literal">
       NULL
      </code>
      .
     </p>
     <p>
      Suppose that table
      <code class="literal">
       t1
      </code>
      contains these rows,
          where
      <code class="literal">
       NULL
      </code>
      indicates something like
      <span class="quote">
       “
       <span class="quote">
        other
       </span>
       ”
      </span>
      or
      <span class="quote">
       “
       <span class="quote">
        unknown
       </span>
       ”
      </span>
      :
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa50095350"><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 operator">*</span> <span class="token keyword">FROM</span> t1<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>
<span class="token output"><span class="token punctuation">|</span> name <span class="token punctuation">|</span> size  <span class="token punctuation">|</span> quantity <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>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> small <span class="token punctuation">|</span>       10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> large <span class="token punctuation">|</span>       20 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> NULL  <span class="token punctuation">|</span>        5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> small <span class="token punctuation">|</span>       15 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> large <span class="token punctuation">|</span>        5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> NULL  <span class="token punctuation">|</span>        3 <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></code></pre>
     </div>
     <p>
      A summary of the table without
      <code class="literal">
       WITH ROLLUP
      </code>
      looks like this:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa31622403"><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 keyword">name</span><span class="token punctuation">,</span> size<span class="token punctuation">,</span> <span class="token function">SUM</span><span class="token punctuation">(</span>quantity<span class="token punctuation">)</span> <span class="token keyword">AS</span> quantity
       <span class="token keyword">FROM</span> t1
       <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">name</span><span class="token punctuation">,</span> size<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>
<span class="token output"><span class="token punctuation">|</span> name <span class="token punctuation">|</span> size  <span class="token punctuation">|</span> quantity <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>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> small <span class="token punctuation">|</span>       10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> large <span class="token punctuation">|</span>       20 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> NULL  <span class="token punctuation">|</span>        5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> small <span class="token punctuation">|</span>       15 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> large <span class="token punctuation">|</span>        5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> NULL  <span class="token punctuation">|</span>        3 <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></code></pre>
     </div>
     <p>
      The result contains
      <code class="literal">
       NULL
      </code>
      values, but those
          do not represent super-aggregate rows because the query does
          not include
      <code class="literal">
       WITH ROLLUP
      </code>
      .
     </p>
     <p>
      Adding
      <code class="literal">
       WITH ROLLUP
      </code>
      produces super-aggregate
          summary rows containing additional
      <code class="literal">
       NULL
      </code>
      values. However, without comparing this result to the previous
          one, it is not easy to see which
      <code class="literal">
       NULL
      </code>
      values occur in super-aggregate rows and which occur in
          regular grouped rows:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa6613181"><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 keyword">name</span><span class="token punctuation">,</span> size<span class="token punctuation">,</span> <span class="token function">SUM</span><span class="token punctuation">(</span>quantity<span class="token punctuation">)</span> <span class="token keyword">AS</span> quantity
       <span class="token keyword">FROM</span> t1
       <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">name</span><span class="token punctuation">,</span> size <span class="token keyword">WITH</span> <span class="token keyword">ROLLUP</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>
<span class="token output"><span class="token punctuation">|</span> name <span class="token punctuation">|</span> size  <span class="token punctuation">|</span> quantity <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>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> NULL  <span class="token punctuation">|</span>        5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> large <span class="token punctuation">|</span>       20 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> small <span class="token punctuation">|</span>       10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> NULL  <span class="token punctuation">|</span>       35 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> NULL  <span class="token punctuation">|</span>        3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> large <span class="token punctuation">|</span>        5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> small <span class="token punctuation">|</span>       15 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> NULL  <span class="token punctuation">|</span>       23 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> NULL  <span class="token punctuation">|</span>       58 <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></code></pre>
     </div>
     <p>
      To distinguish
      <code class="literal">
       NULL
      </code>
      values in
          super-aggregate rows from those in regular grouped rows, use
      <a class="link" href="miscellaneous-functions.html#function_grouping">
       <code class="literal">
        GROUPING()
       </code>
      </a>
      , which returns 1
          only for super-aggregate
      <code class="literal">
       NULL
      </code>
      values:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa26635779"><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 keyword">name</span><span class="token punctuation">,</span> size<span class="token punctuation">,</span> <span class="token function">SUM</span><span class="token punctuation">(</span>quantity<span class="token punctuation">)</span> <span class="token keyword">AS</span> quantity<span class="token punctuation">,</span>
         <span class="token function">GROUPING</span><span class="token punctuation">(</span><span class="token keyword">name</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> grp_name<span class="token punctuation">,</span>
         <span class="token function">GROUPING</span><span class="token punctuation">(</span>size<span class="token punctuation">)</span> <span class="token keyword">AS</span> grp_size
       <span class="token keyword">FROM</span> t1
       <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">name</span><span class="token punctuation">,</span> size <span class="token keyword">WITH</span> <span class="token keyword">ROLLUP</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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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> name <span class="token punctuation">|</span> size  <span class="token punctuation">|</span> quantity <span class="token punctuation">|</span> grp_name <span class="token punctuation">|</span> grp_size <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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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> ball <span class="token punctuation">|</span> NULL  <span class="token punctuation">|</span>        5 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> large <span class="token punctuation">|</span>       20 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> small <span class="token punctuation">|</span>       10 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> NULL  <span class="token punctuation">|</span>       35 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span>        1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> NULL  <span class="token punctuation">|</span>        3 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> large <span class="token punctuation">|</span>        5 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> small <span class="token punctuation">|</span>       15 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> NULL  <span class="token punctuation">|</span>       23 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span>        1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> NULL  <span class="token punctuation">|</span>       58 <span class="token punctuation">|</span>        1 <span class="token punctuation">|</span>        1 <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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>
      Common uses for
      <a class="link" href="miscellaneous-functions.html#function_grouping">
       <code class="literal">
        GROUPING()
       </code>
      </a>
      :
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         Substitute a label for super-aggregate
         <code class="literal">
          NULL
         </code>
         values:
        </p>
        <div class="copytoclipboard-wrapper">
         <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69007312"><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 function">GROUPING</span><span class="token punctuation">(</span><span class="token keyword">name</span><span class="token punctuation">)</span> <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token string">'All items'</span><span class="token punctuation">,</span> <span class="token keyword">name</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> <span class="token keyword">name</span><span class="token punctuation">,</span>
         <span class="token function">IF</span><span class="token punctuation">(</span><span class="token function">GROUPING</span><span class="token punctuation">(</span>size<span class="token punctuation">)</span> <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token string">'All sizes'</span><span class="token punctuation">,</span> size<span class="token punctuation">)</span> <span class="token keyword">AS</span> size<span class="token punctuation">,</span>
         <span class="token function">SUM</span><span class="token punctuation">(</span>quantity<span class="token punctuation">)</span> <span class="token keyword">AS</span> quantity
       <span class="token keyword">FROM</span> t1
       <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">name</span><span class="token punctuation">,</span> size <span class="token keyword">WITH</span> <span class="token keyword">ROLLUP</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 class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> name      <span class="token punctuation">|</span> size      <span class="token punctuation">|</span> quantity <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>
<span class="token output"><span class="token punctuation">|</span> ball      <span class="token punctuation">|</span> NULL      <span class="token punctuation">|</span>        5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball      <span class="token punctuation">|</span> large     <span class="token punctuation">|</span>       20 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball      <span class="token punctuation">|</span> small     <span class="token punctuation">|</span>       10 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball      <span class="token punctuation">|</span> All sizes <span class="token punctuation">|</span>       35 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop      <span class="token punctuation">|</span> NULL      <span class="token punctuation">|</span>        3 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop      <span class="token punctuation">|</span> large     <span class="token punctuation">|</span>        5 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop      <span class="token punctuation">|</span> small     <span class="token punctuation">|</span>       15 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop      <span class="token punctuation">|</span> All sizes <span class="token punctuation">|</span>       23 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> All items <span class="token punctuation">|</span> All sizes <span class="token punctuation">|</span>       58 <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></code></pre>
        </div>
       </li>
       <li class="listitem">
        <p>
         Return only super-aggregate lines by filtering out the
              regular grouped lines:
        </p>
        <div class="copytoclipboard-wrapper">
         <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa63067655"><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 keyword">name</span><span class="token punctuation">,</span> size<span class="token punctuation">,</span> <span class="token function">SUM</span><span class="token punctuation">(</span>quantity<span class="token punctuation">)</span> <span class="token keyword">AS</span> quantity
       <span class="token keyword">FROM</span> t1
       <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">name</span><span class="token punctuation">,</span> size <span class="token keyword">WITH</span> <span class="token keyword">ROLLUP</span>
       <span class="token keyword">HAVING</span> <span class="token function">GROUPING</span><span class="token punctuation">(</span><span class="token keyword">name</span><span class="token punctuation">)</span> <span class="token operator">=</span> <span class="token number">1</span> <span class="token operator">OR</span> <span class="token function">GROUPING</span><span class="token punctuation">(</span>size<span class="token punctuation">)</span> <span class="token operator">=</span> <span class="token number">1</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> name <span class="token punctuation">|</span> size <span class="token punctuation">|</span> quantity <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> ball <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span>       35 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span>       23 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span>       58 <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>
       </li>
      </ul>
     </div>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_grouping">
       <code class="literal">
        GROUPING()
       </code>
      </a>
      permits multiple
          expression arguments. In this case, the
      <a class="link" href="miscellaneous-functions.html#function_grouping">
       <code class="literal">
        GROUPING()
       </code>
      </a>
      return value
          represents a bitmask combined from the results for each
          expression, where the lowest-order bit corresponds to the
          result for the rightmost expression. For example, with three
          expression arguments,
      <a class="link" href="miscellaneous-functions.html#function_grouping">
       <code class="literal">
        GROUPING(
        <em class="replaceable">
         <code>
          expr1
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          expr2
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          expr3
         </code>
        </em>
        )
       </code>
      </a>
      is evaluated like
          this:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-clike"><div class="docs-select-all right" id="sa70688363"><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-clike">  result <span class="token keyword">for</span> <span class="token function">GROUPING</span><span class="token punctuation">(</span><em class="replaceable">expr3</em><span class="token punctuation">)</span>
<span class="token operator">+</span> result <span class="token keyword">for</span> <span class="token function">GROUPING</span><span class="token punctuation">(</span><em class="replaceable">expr2</em><span class="token punctuation">)</span> <span class="token operator">&lt;</span><span class="token operator">&lt;</span> <span class="token number">1</span>
<span class="token operator">+</span> result <span class="token keyword">for</span> <span class="token function">GROUPING</span><span class="token punctuation">(</span><em class="replaceable">expr1</em><span class="token punctuation">)</span> <span class="token operator">&lt;</span><span class="token operator">&lt;</span> <span class="token number">2</span></code></pre>
     </div>
     <p>
      The following query shows how
      <a class="link" href="miscellaneous-functions.html#function_grouping">
       <code class="literal">
        GROUPING()
       </code>
      </a>
      results for single
          arguments combine for a multiple-argument call to produce a
          bitmask value:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa89899373"><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 keyword">name</span><span class="token punctuation">,</span> size<span class="token punctuation">,</span> <span class="token function">SUM</span><span class="token punctuation">(</span>quantity<span class="token punctuation">)</span> <span class="token keyword">AS</span> quantity<span class="token punctuation">,</span>
         <span class="token function">GROUPING</span><span class="token punctuation">(</span><span class="token keyword">name</span><span class="token punctuation">)</span> <span class="token keyword">AS</span> grp_name<span class="token punctuation">,</span>
         <span class="token function">GROUPING</span><span class="token punctuation">(</span>size<span class="token punctuation">)</span> <span class="token keyword">AS</span> grp_size<span class="token punctuation">,</span>
       <span class="token function">GROUPING</span><span class="token punctuation">(</span><span class="token keyword">name</span><span class="token punctuation">,</span> size<span class="token punctuation">)</span> <span class="token keyword">AS</span> grp_all
       <span class="token keyword">FROM</span> t1
       <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">name</span><span class="token punctuation">,</span> size <span class="token keyword">WITH</span> <span class="token keyword">ROLLUP</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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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> name <span class="token punctuation">|</span> size  <span class="token punctuation">|</span> quantity <span class="token punctuation">|</span> grp_name <span class="token punctuation">|</span> grp_size <span class="token punctuation">|</span> grp_all <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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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> ball <span class="token punctuation">|</span> NULL  <span class="token punctuation">|</span>        5 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span>       0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> large <span class="token punctuation">|</span>       20 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span>       0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> small <span class="token punctuation">|</span>       10 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span>       0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> ball <span class="token punctuation">|</span> NULL  <span class="token punctuation">|</span>       35 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span>        1 <span class="token punctuation">|</span>       1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> NULL  <span class="token punctuation">|</span>        3 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span>       0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> large <span class="token punctuation">|</span>        5 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span>       0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> small <span class="token punctuation">|</span>       15 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span>       0 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> NULL  <span class="token punctuation">|</span>       23 <span class="token punctuation">|</span>        0 <span class="token punctuation">|</span>        1 <span class="token punctuation">|</span>       1 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> NULL  <span class="token punctuation">|</span>       58 <span class="token punctuation">|</span>        1 <span class="token punctuation">|</span>        1 <span class="token punctuation">|</span>       3 <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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>
      With multiple expression arguments, the
      <a class="link" href="miscellaneous-functions.html#function_grouping">
       <code class="literal">
        GROUPING()
       </code>
      </a>
      return value is
          nonzero if any expression represents a super-aggregate value.
          Multiple-argument
      <a class="link" href="miscellaneous-functions.html#function_grouping">
       <code class="literal">
        GROUPING()
       </code>
      </a>
      syntax thus provides a simpler way to write the earlier query
          that returned only super-aggregate rows, by using a single
          multiple-argument
      <a class="link" href="miscellaneous-functions.html#function_grouping">
       <code class="literal">
        GROUPING()
       </code>
      </a>
      call rather than multiple single-argument calls:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa13367325"><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 keyword">name</span><span class="token punctuation">,</span> size<span class="token punctuation">,</span> <span class="token function">SUM</span><span class="token punctuation">(</span>quantity<span class="token punctuation">)</span> <span class="token keyword">AS</span> quantity
       <span class="token keyword">FROM</span> t1
       <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">name</span><span class="token punctuation">,</span> size <span class="token keyword">WITH</span> <span class="token keyword">ROLLUP</span>
       <span class="token keyword">HAVING</span> <span class="token function">GROUPING</span><span class="token punctuation">(</span><span class="token keyword">name</span><span class="token punctuation">,</span> size<span class="token punctuation">)</span> <span class="token operator">&lt;&gt;</span> <span class="token number">0</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> name <span class="token punctuation">|</span> size <span class="token punctuation">|</span> quantity <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> ball <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span>       35 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> hoop <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span>       23 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span>       58 <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>
      Use of
      <a class="link" href="miscellaneous-functions.html#function_grouping">
       <code class="literal">
        GROUPING()
       </code>
      </a>
      is subject to
          these limitations:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         Do not use subquery
         <code class="literal">
          GROUP BY
         </code>
         expressions as
         <a class="link" href="miscellaneous-functions.html#function_grouping">
          <code class="literal">
           GROUPING()
          </code>
         </a>
         arguments because matching might fail. For example,
              matching fails for this query:
        </p>
        <div class="copytoclipboard-wrapper">
         <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa20357489"><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">GROUPING</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token function">MAX</span><span class="token punctuation">(</span><span class="token keyword">name</span><span class="token punctuation">)</span> <span class="token keyword">FROM</span> t1<span class="token punctuation">)</span><span class="token punctuation">)</span>
       <span class="token keyword">FROM</span> t1
       <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token punctuation">(</span><span class="token keyword">SELECT</span> <span class="token function">MAX</span><span class="token punctuation">(</span><span class="token keyword">name</span><span class="token punctuation">)</span> <span class="token keyword">FROM</span> t1<span class="token punctuation">)</span> <span class="token keyword">WITH</span> <span class="token keyword">ROLLUP</span><span class="token punctuation">;</span>
<span class="token output">ERROR 3580 (HY000)<span class="token punctuation">:</span> Argument #1 of GROUPING function is not in GROUP BY</span></code></pre>
        </div>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          GROUP BY
         </code>
         literal expressions should not
              be used within a
         <code class="literal">
          HAVING
         </code>
         clause as
         <a class="link" href="miscellaneous-functions.html#function_grouping">
          <code class="literal">
           GROUPING()
          </code>
         </a>
         arguments. Due
              to differences between when the optimizer evaluates
         <code class="literal">
          GROUP BY
         </code>
         and
         <code class="literal">
          HAVING
         </code>
         ,
              matching may succeed but
         <a class="link" href="miscellaneous-functions.html#function_grouping">
          <code class="literal">
           GROUPING()
          </code>
         </a>
         evaluation does
              not produce the expected result. Consider this query:
        </p>
        <div class="copytoclipboard-wrapper">
         <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa57246894"><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">SELECT</span> a <span class="token keyword">AS</span> f1<span class="token punctuation">,</span> <span class="token string">'w'</span> <span class="token keyword">AS</span> f2
<span class="token keyword">FROM</span> t
<span class="token keyword">GROUP</span> <span class="token keyword">BY</span> f1<span class="token punctuation">,</span> f2 <span class="token keyword">WITH</span> <span class="token keyword">ROLLUP</span>
<span class="token keyword">HAVING</span> <span class="token function">GROUPING</span><span class="token punctuation">(</span>f2<span class="token punctuation">)</span> <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span></code></pre>
        </div>
        <p>
         <a class="link" href="miscellaneous-functions.html#function_grouping">
          <code class="literal">
           GROUPING()
          </code>
         </a>
         is evaluated
              earlier for the literal constant expression than for the
         <code class="literal">
          HAVING
         </code>
         clause as a whole and returns 0.
              To check whether a query such as this is affected, use
         <a class="link" href="explain.html" title="15.8.2 EXPLAIN Statement">
          <code class="literal">
           EXPLAIN
          </code>
         </a>
         and look for
         <code class="literal">
          Impossible having
         </code>
         in the
         <code class="literal">
          Extra
         </code>
         column.
        </p>
       </li>
      </ul>
     </div>
     <p>
      For more information about
      <code class="literal">
       WITH ROLLUP
      </code>
      and
      <a class="link" href="miscellaneous-functions.html#function_grouping">
       <code class="literal">
        GROUPING()
       </code>
      </a>
      , see
      <a class="xref" href="group-by-modifiers.html" title="14.19.2 GROUP BY Modifiers">
       Section 14.19.2, “GROUP BY Modifiers”
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <a name="function_inet-aton">
     </a>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_inet-aton">
       <code class="literal">
        INET_ATON(
        <em class="replaceable">
         <code>
          expr
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045190933104">
     </a>
     <p>
      Given the dotted-quad representation of an IPv4 network
          address as a string, returns an integer that represents the
          numeric value of the address in network byte order (big
          endian).
      <a class="link" href="miscellaneous-functions.html#function_inet-aton">
       <code class="literal">
        INET_ATON()
       </code>
      </a>
      returns
      <code class="literal">
       NULL
      </code>
      if it does not understand its
          argument, or if
      <em class="replaceable">
       <code>
        expr
       </code>
      </em>
      is
      <code class="literal">
       NULL
      </code>
      .
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa8962211"><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">INET_ATON</span><span class="token punctuation">(</span><span class="token string">'10.0.5.9'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token number">167773449</span></code></pre>
     </div>
     <p>
      For this example, the return value is calculated as
          10×256
      <sup>
       3
      </sup>
      +
          0×256
      <sup>
       2
      </sup>
      + 5×256 + 9.
     </p>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_inet-aton">
       <code class="literal">
        INET_ATON()
       </code>
      </a>
      may or may not
          return a non-
      <code class="literal">
       NULL
      </code>
      result for short-form IP
          addresses (such as
      <code class="literal">
       '127.1'
      </code>
      as a
          representation of
      <code class="literal">
       '127.0.0.1'
      </code>
      ). Because of
          this,
      <a class="link" href="miscellaneous-functions.html#function_inet-aton">
       <code class="literal">
        INET_ATON()
       </code>
      </a>
      a should not
          be used for such addresses.
     </p>
     <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Note
      </div>
      <p>
       To store values generated by
       <a class="link" href="miscellaneous-functions.html#function_inet-aton">
        <code class="literal">
         INET_ATON()
        </code>
       </a>
       , use an
       <code class="literal">
        INT UNSIGNED
       </code>
       column rather than
       <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>
       , which is signed. If you
            use a signed column, values corresponding to IP addresses
            for which the first octet is greater than 127 cannot be
            stored correctly. See
       <a class="xref" href="out-of-range-and-overflow.html" title="13.1.7 Out-of-Range and Overflow Handling">
        Section 13.1.7, “Out-of-Range and Overflow Handling”
       </a>
       .
      </p>
     </div>
    </li>
    <li class="listitem">
     <a name="function_inet-ntoa">
     </a>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_inet-ntoa">
       <code class="literal">
        INET_NTOA(
        <em class="replaceable">
         <code>
          expr
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045190908144">
     </a>
     <p>
      Given a numeric IPv4 network address in network byte order,
          returns the dotted-quad string representation of the address
          as a string in the connection character set.
      <a class="link" href="miscellaneous-functions.html#function_inet-ntoa">
       <code class="literal">
        INET_NTOA()
       </code>
      </a>
      returns
      <code class="literal">
       NULL
      </code>
      if it does not understand its
          argument.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa50439609"><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">INET_NTOA</span><span class="token punctuation">(</span><span class="token number">167773449</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'10.0.5.9'</span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_inet6-aton">
     </a>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_inet6-aton">
       <code class="literal">
        INET6_ATON(
        <em class="replaceable">
         <code>
          expr
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045190895840">
     </a>
     <p>
      Given an IPv6 or IPv4 network address as a string, returns a
          binary string that represents the numeric value of the address
          in network byte order (big endian). Because numeric-format
          IPv6 addresses require more bytes than the largest integer
          type, the representation returned by this function has the
      <a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
       <code class="literal">
        VARBINARY
       </code>
      </a>
      data type:
      <a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
       <code class="literal">
        VARBINARY(16)
       </code>
      </a>
      for IPv6
          addresses and
      <a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
       <code class="literal">
        VARBINARY(4)
       </code>
      </a>
      for
          IPv4 addresses. If the argument is not a valid address, or if
          it is
      <code class="literal">
       NULL
      </code>
      ,
      <a class="link" href="miscellaneous-functions.html#function_inet6-aton">
       <code class="literal">
        INET6_ATON()
       </code>
      </a>
      returns
      <code class="literal">
       NULL
      </code>
      .
     </p>
     <p>
      The following examples use
      <a class="link" href="string-functions.html#function_hex">
       <code class="literal">
        HEX()
       </code>
      </a>
      to display the
      <a class="link" href="miscellaneous-functions.html#function_inet6-aton">
       <code class="literal">
        INET6_ATON()
       </code>
      </a>
      result in
          printable form:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa42250371"><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">HEX</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'fdfe::5a55:caff:fefa:9089'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'FDFE0000000000005A55CAFFFEFA9089'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'10.0.5.9'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'0A000509'</span></code></pre>
     </div>
     <p>
      <code class="literal">
       INET6_ATON()
      </code>
      observes several constraints
          on valid arguments. These are given in the following list
          along with examples.
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         A trailing zone ID is not permitted, as in
         <code class="literal">
          fe80::3%1
         </code>
         or
         <code class="literal">
          fe80::3%eth0
         </code>
         .
        </p>
       </li>
       <li class="listitem">
        <p>
         A trailing network mask is not permitted, as in
         <code class="literal">
          2001:45f:3:ba::/64
         </code>
         or
         <code class="literal">
          198.51.100.0/24
         </code>
         .
        </p>
       </li>
       <li class="listitem">
        <p>
         For values representing IPv4 addresses, only classless
              addresses are supported. Classful addresses such as
         <code class="literal">
          198.51.1
         </code>
         are rejected. A trailing port
              number is not permitted, as in
         <code class="literal">
          198.51.100.2:8080
         </code>
         . Hexadecimal numbers
              in address components are not permitted, as in
         <code class="literal">
          198.0xa0.1.2
         </code>
         . Octal numbers are not
              supported:
         <code class="literal">
          198.51.010.1
         </code>
         is treated as
         <code class="literal">
          198.51.10.1
         </code>
         , not
         <code class="literal">
          198.51.8.1
         </code>
         . These IPv4 constraints also
              apply to IPv6 addresses that have IPv4 address parts, such
              as IPv4-compatible or IPv4-mapped addresses.
        </p>
       </li>
      </ul>
     </div>
     <p>
      To convert an IPv4 address
      <em class="replaceable">
       <code>
        expr
       </code>
      </em>
      represented in numeric form as an
      <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>
      value to an IPv6 address
          represented in numeric form as a
      <a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
       <code class="literal">
        VARBINARY
       </code>
      </a>
      value, use this
          expression:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa47716196"><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 function">INET6_ATON</span><span class="token punctuation">(</span><span class="token function">INET_NTOA</span><span class="token punctuation">(</span><em class="replaceable">expr</em><span class="token punctuation">)</span><span class="token punctuation">)</span></code></pre>
     </div>
     <p>
      For example:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa5946371"><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">HEX</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token function">INET_NTOA</span><span class="token punctuation">(</span><span class="token number">167773449</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">        -&gt;</span> <span class="token string">'0A000509'</span></code></pre>
     </div>
     <p>
      If
      <a class="link" href="miscellaneous-functions.html#function_inet6-aton">
       <code class="literal">
        INET6_ATON()
       </code>
      </a>
      is invoked from
          within the
      <a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
       <span class="command">
        <strong>
         mysql
        </strong>
       </span>
      </a>
      client, binary strings
          display using hexadecimal notation, depending on the value of
          the
      <a class="link" href="mysql-command-options.html#option_mysql_binary-as-hex">
       <code class="option">
        --binary-as-hex
       </code>
      </a>
      . For more
          information about that option, see
      <a class="xref" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
       Section 6.5.1, “mysql — The MySQL Command-Line Client”
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <a name="function_inet6-ntoa">
     </a>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_inet6-ntoa">
       <code class="literal">
        INET6_NTOA(
        <em class="replaceable">
         <code>
          expr
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045190851648">
     </a>
     <p>
      Given an IPv6 or IPv4 network address represented in numeric
          form as a binary string, returns the string representation of
          the address as a string in the connection character set. If
          the argument is not a valid address, or if it is
      <code class="literal">
       NULL
      </code>
      ,
      <a class="link" href="miscellaneous-functions.html#function_inet6-ntoa">
       <code class="literal">
        INET6_NTOA()
       </code>
      </a>
      returns
      <code class="literal">
       NULL
      </code>
      .
     </p>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_inet6-ntoa">
       <code class="literal">
        INET6_NTOA()
       </code>
      </a>
      has these
          properties:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         It does not use operating system functions to perform
              conversions, thus the output string is platform
              independent.
        </p>
       </li>
       <li class="listitem">
        <p>
         The return string has a maximum length of 39 (4 x 8 + 7).
              Given this statement:
        </p>
        <div class="copytoclipboard-wrapper">
         <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa81825717"><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 keyword">AS</span> <span class="token keyword">SELECT</span> <span class="token function">INET6_NTOA</span><span class="token punctuation">(</span><em class="replaceable">expr</em><span class="token punctuation">)</span> <span class="token keyword">AS</span> c1<span class="token punctuation">;</span></code></pre>
        </div>
        <p>
         The resulting table would have this definition:
        </p>
        <div class="copytoclipboard-wrapper">
         <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa90311280"><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>c1 <span class="token datatype">VARCHAR</span><span class="token punctuation">(</span><span class="token number">39</span><span class="token punctuation">)</span> <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> utf8mb3 <span class="token keyword">DEFAULT</span> <span class="token boolean">NULL</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
        </div>
       </li>
       <li class="listitem">
        <p>
         The return string uses lowercase letters for IPv6
              addresses.
        </p>
       </li>
      </ul>
     </div>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa88516329"><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">INET6_NTOA</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'fdfe::5a55:caff:fefa:9089'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'fdfe::5a55:caff:fefa:9089'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">INET6_NTOA</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'10.0.5.9'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'10.0.5.9'</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">INET6_NTOA</span><span class="token punctuation">(</span><span class="token function">UNHEX</span><span class="token punctuation">(</span><span class="token string">'FDFE0000000000005A55CAFFFEFA9089'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'fdfe::5a55:caff:fefa:9089'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">INET6_NTOA</span><span class="token punctuation">(</span><span class="token function">UNHEX</span><span class="token punctuation">(</span><span class="token string">'0A000509'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'10.0.5.9'</span></code></pre>
     </div>
     <p>
      If
      <a class="link" href="miscellaneous-functions.html#function_inet6-ntoa">
       <code class="literal">
        INET6_NTOA()
       </code>
      </a>
      is invoked from
          within the
      <a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
       <span class="command">
        <strong>
         mysql
        </strong>
       </span>
      </a>
      client, binary strings
          display using hexadecimal notation, depending on the value of
          the
      <a class="link" href="mysql-command-options.html#option_mysql_binary-as-hex">
       <code class="option">
        --binary-as-hex
       </code>
      </a>
      . For more
          information about that option, see
      <a class="xref" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
       Section 6.5.1, “mysql — The MySQL Command-Line Client”
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <a name="function_is-ipv4">
     </a>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_is-ipv4">
       <code class="literal">
        IS_IPV4(
        <em class="replaceable">
         <code>
          expr
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045190823536">
     </a>
     <p>
      Returns 1 if the argument is a valid IPv4 address specified as
          a string, 0 otherwise. Returns
      <code class="literal">
       NULL
      </code>
      if
      <em class="replaceable">
       <code>
        expr
       </code>
      </em>
      is
      <code class="literal">
       NULL
      </code>
      .
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa95792198"><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">IS_IPV4</span><span class="token punctuation">(</span><span class="token string">'10.0.5.9'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">IS_IPV4</span><span class="token punctuation">(</span><span class="token string">'10.0.5.256'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">0</span></code></pre>
     </div>
     <p>
      For a given argument, if
      <a class="link" href="miscellaneous-functions.html#function_is-ipv4">
       <code class="literal">
        IS_IPV4()
       </code>
      </a>
      returns 1,
      <a class="link" href="miscellaneous-functions.html#function_inet-aton">
       <code class="literal">
        INET_ATON()
       </code>
      </a>
      (and
      <a class="link" href="miscellaneous-functions.html#function_inet6-aton">
       <code class="literal">
        INET6_ATON()
       </code>
      </a>
      ) returns
          non-
      <code class="literal">
       NULL
      </code>
      . The converse statement is not
          true: In some cases,
      <a class="link" href="miscellaneous-functions.html#function_inet-aton">
       <code class="literal">
        INET_ATON()
       </code>
      </a>
      returns
          non-
      <code class="literal">
       NULL
      </code>
      when
      <a class="link" href="miscellaneous-functions.html#function_is-ipv4">
       <code class="literal">
        IS_IPV4()
       </code>
      </a>
      returns 0.
     </p>
     <p>
      As implied by the preceding remarks,
      <a class="link" href="miscellaneous-functions.html#function_is-ipv4">
       <code class="literal">
        IS_IPV4()
       </code>
      </a>
      is more strict than
      <a class="link" href="miscellaneous-functions.html#function_inet-aton">
       <code class="literal">
        INET_ATON()
       </code>
      </a>
      about what
          constitutes a valid IPv4 address, so it may be useful for
          applications that need to perform strong checks against
          invalid values. Alternatively, use
      <a class="link" href="miscellaneous-functions.html#function_inet6-aton">
       <code class="literal">
        INET6_ATON()
       </code>
      </a>
      to convert IPv4
          addresses to internal form and check for a
      <code class="literal">
       NULL
      </code>
      result (which indicates an invalid
          address).
      <a class="link" href="miscellaneous-functions.html#function_inet6-aton">
       <code class="literal">
        INET6_ATON()
       </code>
      </a>
      is
          equally strong as
      <a class="link" href="miscellaneous-functions.html#function_is-ipv4">
       <code class="literal">
        IS_IPV4()
       </code>
      </a>
      about checking IPv4 addresses.
     </p>
    </li>
    <li class="listitem">
     <a name="function_is-ipv4-compat">
     </a>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_is-ipv4-compat">
       <code class="literal">
        IS_IPV4_COMPAT(
        <em class="replaceable">
         <code>
          expr
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045190795408">
     </a>
     <p>
      This function takes an IPv6 address represented in numeric
          form as a binary string, as returned by
      <a class="link" href="miscellaneous-functions.html#function_inet6-aton">
       <code class="literal">
        INET6_ATON()
       </code>
      </a>
      . It returns 1 if
          the argument is a valid IPv4-compatible IPv6 address, 0
          otherwise (unless
      <em class="replaceable">
       <code>
        expr
       </code>
      </em>
      is
      <code class="literal">
       NULL
      </code>
      , in which case the function returns
      <code class="literal">
       NULL
      </code>
      ). IPv4-compatible addresses have the
          form
      <code class="literal">
       ::
       <em class="replaceable">
        <code>
         ipv4_address
        </code>
       </em>
      </code>
      .
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa16986385"><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">IS_IPV4_COMPAT</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'::10.0.5.9'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token number">1</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">IS_IPV4_COMPAT</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'::ffff:10.0.5.9'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token number">0</span></code></pre>
     </div>
     <p>
      The IPv4 part of an IPv4-compatible address can also be
          represented using hexadecimal notation. For example,
      <code class="literal">
       198.51.100.1
      </code>
      has this raw hexadecimal
          value:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa4869400"><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">HEX</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'198.51.100.1'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'C6336401'</span></code></pre>
     </div>
     <p>
      Expressed in IPv4-compatible form,
      <code class="literal">
       ::198.51.100.1
      </code>
      is equivalent to
      <code class="literal">
       ::c0a8:0001
      </code>
      or (without leading zeros)
      <code class="literal">
       ::c0a8:1
      </code>
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa36716813"><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 prompt">    -&gt;</span>   <span class="token function">IS_IPV4_COMPAT</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'::198.51.100.1'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt">    -&gt;</span>   <span class="token function">IS_IPV4_COMPAT</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'::c0a8:0001'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt">    -&gt;</span>   <span class="token function">IS_IPV4_COMPAT</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'::c0a8:1'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">1</span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_is-ipv4-mapped">
     </a>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_is-ipv4-mapped">
       <code class="literal">
        IS_IPV4_MAPPED(
        <em class="replaceable">
         <code>
          expr
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045190770480">
     </a>
     <p>
      This function takes an IPv6 address represented in numeric
          form as a binary string, as returned by
      <a class="link" href="miscellaneous-functions.html#function_inet6-aton">
       <code class="literal">
        INET6_ATON()
       </code>
      </a>
      . It returns 1 if
          the argument is a valid IPv4-mapped IPv6 address, 0 otherwise,
          unless
      <em class="replaceable">
       <code>
        expr
       </code>
      </em>
      is
      <code class="literal">
       NULL
      </code>
      , in which case the function returns
      <code class="literal">
       NULL
      </code>
      . IPv4-mapped addresses have the form
      <code class="literal">
       ::ffff:
       <em class="replaceable">
        <code>
         ipv4_address
        </code>
       </em>
      </code>
      .
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa65108168"><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">IS_IPV4_MAPPED</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'::10.0.5.9'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token number">0</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">IS_IPV4_MAPPED</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'::ffff:10.0.5.9'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token number">1</span></code></pre>
     </div>
     <p>
      As with
      <code class="literal">
       IS_IPV4_COMPAT()
      </code>
      the IPv4 part of
          an IPv4-mapped address can also be represented using
          hexadecimal notation:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa19102107"><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 prompt">    -&gt;</span>   <span class="token function">IS_IPV4_MAPPED</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'::ffff:198.51.100.1'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt">    -&gt;</span>   <span class="token function">IS_IPV4_MAPPED</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'::ffff:c0a8:0001'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
<span class="token prompt">    -&gt;</span>   <span class="token function">IS_IPV4_MAPPED</span><span class="token punctuation">(</span><span class="token function">INET6_ATON</span><span class="token punctuation">(</span><span class="token string">'::ffff:c0a8:1'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">1</span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_is-ipv6">
     </a>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_is-ipv6">
       <code class="literal">
        IS_IPV6(
        <em class="replaceable">
         <code>
          expr
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045190749872">
     </a>
     <p>
      Returns 1 if the argument is a valid IPv6 address specified as
          a string, 0 otherwise, unless
      <em class="replaceable">
       <code>
        expr
       </code>
      </em>
      is
      <code class="literal">
       NULL
      </code>
      , in which case the function returns
      <code class="literal">
       NULL
      </code>
      . This function does not consider IPv4
          addresses to be valid IPv6 addresses.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa53246965"><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">IS_IPV6</span><span class="token punctuation">(</span><span class="token string">'10.0.5.9'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">IS_IPV6</span><span class="token punctuation">(</span><span class="token string">'::1'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token number">1</span></code></pre>
     </div>
     <p>
      For a given argument, if
      <a class="link" href="miscellaneous-functions.html#function_is-ipv6">
       <code class="literal">
        IS_IPV6()
       </code>
      </a>
      returns 1,
      <a class="link" href="miscellaneous-functions.html#function_inet6-aton">
       <code class="literal">
        INET6_ATON()
       </code>
      </a>
      returns
          non-
      <code class="literal">
       NULL
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <a name="function_is-uuid">
     </a>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_is-uuid">
       <code class="literal">
        IS_UUID(
        <em class="replaceable">
         <code>
          string_uuid
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045190734016">
     </a>
     <p>
      Returns 1 if the argument is a valid string-format UUID, 0 if
          the argument is not a valid UUID, and
      <code class="literal">
       NULL
      </code>
      if the argument is
      <code class="literal">
       NULL
      </code>
      .
     </p>
     <p>
      <span class="quote">
       “
       <span class="quote">
        Valid
       </span>
       ”
      </span>
      means that the value is in a format that
          can be parsed. That is, it has the correct length and contains
          only the permitted characters (hexadecimal digits in any
          lettercase and, optionally, dashes and curly braces). This
          format is most common:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa23724527"><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-none">aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</code></pre>
     </div>
     <p>
      These other formats are also permitted:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-none"><div class="docs-select-all right" id="sa13600500"><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-none">aaaaaaaabbbbccccddddeeeeeeeeeeee
{aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee}</code></pre>
     </div>
     <p>
      For the meanings of fields within the value, see the
      <a class="link" href="miscellaneous-functions.html#function_uuid">
       <code class="literal">
        UUID()
       </code>
      </a>
      function description.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa8433069"><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">IS_UUID</span><span class="token punctuation">(</span><span class="token string">'6ccd780c-baba-1026-9564-5b8c656024db'</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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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> IS_UUID('6ccd780c<span class="token punctuation">-</span>baba<span class="token punctuation">-</span>1026<span class="token punctuation">-</span>9564<span class="token punctuation">-</span>5b8c656024db') <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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>                                               1 <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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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">IS_UUID</span><span class="token punctuation">(</span><span class="token string">'6CCD780C-BABA-1026-9564-5B8C656024DB'</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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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> IS_UUID('6CCD780C<span class="token punctuation">-</span>BABA<span class="token punctuation">-</span>1026<span class="token punctuation">-</span>9564<span class="token punctuation">-</span>5B8C656024DB') <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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>                                               1 <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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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">IS_UUID</span><span class="token punctuation">(</span><span class="token string">'6ccd780cbaba102695645b8c656024db'</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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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> IS_UUID('6ccd780cbaba102695645b8c656024db') <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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>                                           1 <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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="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">IS_UUID</span><span class="token punctuation">(</span><span class="token string">'{6ccd780c-baba-1026-9564-5b8c656024db}'</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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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> IS_UUID('{6ccd780c<span class="token punctuation">-</span>baba<span class="token punctuation">-</span>1026<span class="token punctuation">-</span>9564<span class="token punctuation">-</span>5b8c656024db}') <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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>                                                 1 <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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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">IS_UUID</span><span class="token punctuation">(</span><span class="token string">'6ccd780c-baba-1026-9564-5b8c6560'</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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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> IS_UUID('6ccd780c<span class="token punctuation">-</span>baba<span class="token punctuation">-</span>1026<span class="token punctuation">-</span>9564<span class="token punctuation">-</span>5b8c6560') <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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="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>                                           0 <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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="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">IS_UUID</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 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>
<span class="token output"><span class="token punctuation">|</span> IS_UUID(RAND()) <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>
<span class="token output"><span class="token punctuation">|</span>               0 <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></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_name-const">
     </a>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_name-const">
       <code class="literal">
        NAME_CONST(
        <em class="replaceable">
         <code>
          name
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          value
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045190710784">
     </a>
     <p>
      Returns the given value. When used to produce a result set
          column,
      <a class="link" href="miscellaneous-functions.html#function_name-const">
       <code class="literal">
        NAME_CONST()
       </code>
      </a>
      causes the
          column to have the given name. The arguments should be
          constants.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa29241425"><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">NAME_CONST</span><span class="token punctuation">(</span><span class="token string">'myname'</span><span class="token punctuation">,</span> <span class="token number">14</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>
<span class="token output"><span class="token punctuation">|</span> myname <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>
<span class="token output"><span class="token punctuation">|</span>     14 <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></code></pre>
     </div>
     <p>
      This function is for internal use only. The server uses it
          when writing statements from stored programs that contain
          references to local program variables, as described in
      <a class="xref" href="stored-programs-logging.html" title="27.7 Stored Program Binary Logging">
       Section 27.7, “Stored Program Binary Logging”
      </a>
      . You might see this
          function in the output from
      <a class="link" href="mysqlbinlog.html" title="6.6.9 mysqlbinlog — Utility for Processing Binary Log Files">
       <span class="command">
        <strong>
         mysqlbinlog
        </strong>
       </span>
      </a>
      .
     </p>
     <p>
      For your applications, you can obtain exactly the same result
          as in the example just shown by using simple aliasing, like
          this:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa83253391"><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 number">14</span> <span class="token keyword">AS</span> myname<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>
<span class="token output"><span class="token punctuation">|</span> myname <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>
<span class="token output"><span class="token punctuation">|</span>     14 <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>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
     </div>
     <p>
      See
      <a class="xref" href="select.html" title="15.2.13 SELECT Statement">
       Section 15.2.13, “SELECT Statement”
      </a>
      , for more information about
          column aliases.
     </p>
    </li>
    <li class="listitem">
     <a name="function_sleep">
     </a>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_sleep">
       <code class="literal">
        SLEEP(
        <em class="replaceable">
         <code>
          duration
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045190693776">
     </a>
     <p>
      Sleeps (pauses) for the number of seconds given by the
      <em class="replaceable">
       <code>
        duration
       </code>
      </em>
      argument, then returns 0.
          The duration may have a fractional part. If the argument is
      <code class="literal">
       NULL
      </code>
      or negative,
      <a class="link" href="miscellaneous-functions.html#function_sleep">
       <code class="literal">
        SLEEP()
       </code>
      </a>
      produces a warning, or
          an error in strict SQL mode.
     </p>
     <p>
      When sleep returns normally (without interruption), it returns
          0:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa42266452"><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">SLEEP</span><span class="token punctuation">(</span><span class="token number">1000</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>
<span class="token output"><span class="token punctuation">|</span> SLEEP(1000) <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>
<span class="token output"><span class="token punctuation">|</span>           0 <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></code></pre>
     </div>
     <p>
      When
      <a class="link" href="miscellaneous-functions.html#function_sleep">
       <code class="literal">
        SLEEP()
       </code>
      </a>
      is the only thing
          invoked by a query that is interrupted, it returns 1 and the
          query itself returns no error. This is true whether the query
          is killed or times out:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         This statement is interrupted using
         <a class="link" href="kill.html" title="15.7.8.4 KILL Statement">
          <code class="literal">
           KILL QUERY
          </code>
         </a>
         from another session:
        </p>
        <div class="copytoclipboard-wrapper">
         <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa65639593"><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">SLEEP</span><span class="token punctuation">(</span><span class="token number">1000</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>
<span class="token output"><span class="token punctuation">|</span> SLEEP(1000) <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>
<span class="token output"><span class="token punctuation">|</span>           1 <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></code></pre>
        </div>
       </li>
       <li class="listitem">
        <p>
         This statement is interrupted by timing out:
        </p>
        <div class="copytoclipboard-wrapper">
         <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa68270748"><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 comment" spellcheck="true">/*+ MAX_EXECUTION_TIME(1) */</span> <span class="token function">SLEEP</span><span class="token punctuation">(</span><span class="token number">1000</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>
<span class="token output"><span class="token punctuation">|</span> SLEEP(1000) <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>
<span class="token output"><span class="token punctuation">|</span>           1 <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></code></pre>
        </div>
       </li>
      </ul>
     </div>
     <p>
      When
      <a class="link" href="miscellaneous-functions.html#function_sleep">
       <code class="literal">
        SLEEP()
       </code>
      </a>
      is only part of a
          query that is interrupted, the query returns an error:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         This statement is interrupted using
         <a class="link" href="kill.html" title="15.7.8.4 KILL Statement">
          <code class="literal">
           KILL QUERY
          </code>
         </a>
         from another session:
        </p>
        <div class="copytoclipboard-wrapper">
         <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa54710479"><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 number">1</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">WHERE</span> <span class="token function">SLEEP</span><span class="token punctuation">(</span><span class="token number">1000</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1317 (70100)<span class="token punctuation">:</span> Query execution was interrupted</span></code></pre>
        </div>
       </li>
       <li class="listitem">
        <p>
         This statement is interrupted by timing out:
        </p>
        <div class="copytoclipboard-wrapper">
         <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa58120200"><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 comment" spellcheck="true">/*+ MAX_EXECUTION_TIME(1000) */</span> <span class="token number">1</span> <span class="token keyword">FROM</span> t1 <span class="token keyword">WHERE</span> <span class="token function">SLEEP</span><span class="token punctuation">(</span><span class="token number">1000</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token output">ERROR 3024 (HY000)<span class="token punctuation">:</span> Query execution was interrupted, maximum statement
execution time exceeded</span></code></pre>
        </div>
       </li>
      </ul>
     </div>
     <p>
      This function is unsafe for statement-based replication. A
          warning is logged if you use this function 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">
       STATEMENT
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <a name="function_uuid">
     </a>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_uuid">
       <code class="literal">
        UUID()
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045190661728">
     </a>
     <p>
      Returns a Universal Unique Identifier (UUID) generated
          according to RFC 4122,
      <span class="quote">
       “
       <span class="quote">
        A Universally Unique IDentifier
          (UUID) URN Namespace
       </span>
       ”
      </span>
      (
      <a class="ulink" href="http://www.ietf.org/rfc/rfc4122.txt" target="_blank">
       http://www.ietf.org/rfc/rfc4122.txt
      </a>
      ).
     </p>
     <p>
      A UUID is designed as a number that is globally unique in
          space and time. Two calls to
      <a class="link" href="miscellaneous-functions.html#function_uuid">
       <code class="literal">
        UUID()
       </code>
      </a>
      are expected to generate
          two different values, even if these calls are performed on two
          separate devices not connected to each other.
     </p>
     <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Warning
      </div>
      <p>
       Although
       <a class="link" href="miscellaneous-functions.html#function_uuid">
        <code class="literal">
         UUID()
        </code>
       </a>
       values are
            intended to be unique, they are not necessarily unguessable
            or unpredictable. If unpredictability is required, UUID
            values should be generated some other way.
      </p>
     </div>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_uuid">
       <code class="literal">
        UUID()
       </code>
      </a>
      returns a value that
          conforms to UUID version 1 as described in RFC 4122. The value
          is a 128-bit number represented as a
      <code class="literal">
       utf8mb3
      </code>
      string of five hexadecimal numbers
          in
      <code class="literal">
       aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
      </code>
      format:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         The first three numbers are generated from the low,
              middle, and high parts of a timestamp. The high part also
              includes the UUID version number.
        </p>
       </li>
       <li class="listitem">
        <p>
         The fourth number preserves temporal uniqueness in case
              the timestamp value loses monotonicity (for example, due
              to daylight saving time).
        </p>
       </li>
       <li class="listitem">
        <p>
         The fifth number is an IEEE 802 node number that provides
              spatial uniqueness. A random number is substituted if the
              latter is not available (for example, because the host
              device has no Ethernet card, or it is unknown how to find
              the hardware address of an interface on the host operating
              system). In this case, spatial uniqueness cannot be
              guaranteed. Nevertheless, a collision should have
         <span class="emphasis">
          <em>
           very
          </em>
         </span>
         low probability.
        </p>
        <p>
         The MAC address of an interface is taken into account only
              on FreeBSD, Linux, and Windows. On other operating
              systems, MySQL uses a randomly generated 48-bit number.
        </p>
       </li>
      </ul>
     </div>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa18387953"><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">UUID</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'6ccd780c-baba-1026-9564-5b8c656024db'</span></code></pre>
     </div>
     <p>
      To convert between string and binary UUID values, use the
      <a class="link" href="miscellaneous-functions.html#function_uuid-to-bin">
       <code class="literal">
        UUID_TO_BIN()
       </code>
      </a>
      and
      <a class="link" href="miscellaneous-functions.html#function_bin-to-uuid">
       <code class="literal">
        BIN_TO_UUID()
       </code>
      </a>
      functions. To
          check whether a string is a valid UUID value, use the
      <a class="link" href="miscellaneous-functions.html#function_is-uuid">
       <code class="literal">
        IS_UUID()
       </code>
      </a>
      function.
     </p>
     <p>
      This function is unsafe for statement-based replication. A
          warning is logged if you use this function 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">
       STATEMENT
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <a name="function_uuid-short">
     </a>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_uuid-short">
       <code class="literal">
        UUID_SHORT()
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045190631424">
     </a>
     <p>
      Returns a
      <span class="quote">
       “
       <span class="quote">
        short
       </span>
       ”
      </span>
      universal identifier as a
          64-bit unsigned integer. Values returned by
      <a class="link" href="miscellaneous-functions.html#function_uuid-short">
       <code class="literal">
        UUID_SHORT()
       </code>
      </a>
      differ from the
          string-format 128-bit identifiers returned by the
      <a class="link" href="miscellaneous-functions.html#function_uuid">
       <code class="literal">
        UUID()
       </code>
      </a>
      function and have
          different uniqueness properties. The value of
      <a class="link" href="miscellaneous-functions.html#function_uuid-short">
       <code class="literal">
        UUID_SHORT()
       </code>
      </a>
      is guaranteed to
          be unique if the following conditions hold:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         The
         <a class="link" href="replication-options.html#sysvar_server_id">
          <code class="literal">
           server_id
          </code>
         </a>
         value of
              the current server is between 0 and 255 and is unique
              among your set of source and replica servers
        </p>
       </li>
       <li class="listitem">
        <p>
         You do not set back the system time for your server host
              between
         <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
          <span class="command">
           <strong>
            mysqld
           </strong>
          </span>
         </a>
         restarts
        </p>
       </li>
       <li class="listitem">
        <p>
         You invoke
         <a class="link" href="miscellaneous-functions.html#function_uuid-short">
          <code class="literal">
           UUID_SHORT()
          </code>
         </a>
         on
              average fewer than 16 million times per second between
         <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
          <span class="command">
           <strong>
            mysqld
           </strong>
          </span>
         </a>
         restarts
        </p>
       </li>
      </ul>
     </div>
     <p>
      The
      <a class="link" href="miscellaneous-functions.html#function_uuid-short">
       <code class="literal">
        UUID_SHORT()
       </code>
      </a>
      return value
          is constructed this way:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-clike"><div class="docs-select-all right" id="sa4558393"><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-clike">  <span class="token punctuation">(</span>server_id <span class="token operator">&amp;</span> <span class="token number">255</span><span class="token punctuation">)</span> <span class="token operator">&lt;</span><span class="token operator">&lt;</span> <span class="token number">56</span>
<span class="token operator">+</span> <span class="token punctuation">(</span>server_startup_time_in_seconds <span class="token operator">&lt;</span><span class="token operator">&lt;</span> <span class="token number">24</span><span class="token punctuation">)</span>
<span class="token operator">+</span> incremented_variable<span class="token operator">++</span><span class="token punctuation">;</span></code></pre>
     </div>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa46978848"><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">UUID_SHORT</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token number">92395783831158784</span></code></pre>
     </div>
     <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Note
      </div>
      <p>
       <a class="link" href="miscellaneous-functions.html#function_uuid-short">
        <code class="literal">
         UUID_SHORT()
        </code>
       </a>
       does not work
            with statement-based replication.
      </p>
     </div>
    </li>
    <li class="listitem">
     <a name="function_uuid-to-bin">
     </a>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_uuid-to-bin">
       <code class="literal">
        UUID_TO_BIN(
        <em class="replaceable">
         <code>
          string_uuid
         </code>
        </em>
        )
       </code>
      </a>
      ,
      <a class="link" href="miscellaneous-functions.html#function_uuid-to-bin">
       <code class="literal">
        UUID_TO_BIN(
        <em class="replaceable">
         <code>
          string_uuid
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          swap_flag
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045190601936">
     </a>
     <p>
      Converts a string UUID to a binary UUID and returns the
          result. (The
      <a class="link" href="miscellaneous-functions.html#function_is-uuid">
       <code class="literal">
        IS_UUID()
       </code>
      </a>
      function
          description lists the permitted string UUID formats.) The
          return binary UUID is a
      <a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
       <code class="literal">
        VARBINARY(16)
       </code>
      </a>
      value. If the
          UUID argument is
      <code class="literal">
       NULL
      </code>
      , the return value is
      <code class="literal">
       NULL
      </code>
      . If any argument is invalid, an error
          occurs.
     </p>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_uuid-to-bin">
       <code class="literal">
        UUID_TO_BIN()
       </code>
      </a>
      takes one or two
          arguments:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         The one-argument form takes a string UUID value. The
              binary result is in the same order as the string argument.
        </p>
       </li>
       <li class="listitem">
        <p>
         The two-argument form takes a string UUID value and a flag
              value:
        </p>
        <div class="itemizedlist">
         <ul class="itemizedlist" style="list-style-type: square; ">
          <li class="listitem">
           <p>
            If
            <em class="replaceable">
             <code>
              swap_flag
             </code>
            </em>
            is 0, the
                  two-argument form is equivalent to the one-argument
                  form. The binary result is in the same order as the
                  string argument.
           </p>
          </li>
          <li class="listitem">
           <p>
            If
            <em class="replaceable">
             <code>
              swap_flag
             </code>
            </em>
            is 1, the
                  format of the return value differs: The time-low and
                  time-high parts (the first and third groups of
                  hexadecimal digits, respectively) are swapped. This
                  moves the more rapidly varying part to the right and
                  can improve indexing efficiency if the result is
                  stored in an indexed column.
           </p>
          </li>
         </ul>
        </div>
       </li>
      </ul>
     </div>
     <p>
      Time-part swapping assumes the use of UUID version 1 values,
          such as are generated by the
      <a class="link" href="miscellaneous-functions.html#function_uuid">
       <code class="literal">
        UUID()
       </code>
      </a>
      function. For UUID
          values produced by other means that do not follow version 1
          format, time-part swapping provides no benefit. For details
          about version 1 format, see the
      <a class="link" href="miscellaneous-functions.html#function_uuid">
       <code class="literal">
        UUID()
       </code>
      </a>
      function description.
     </p>
     <p>
      Suppose that you have the following string UUID value:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa63649367"><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">SET</span> <span class="token variable">@uuid</span> <span class="token operator">=</span> <span class="token string">'6ccd780c-baba-1026-9564-5b8c656024db'</span><span class="token punctuation">;</span></code></pre>
     </div>
     <p>
      To convert the string UUID to binary with or without time-part
          swapping, use
      <a class="link" href="miscellaneous-functions.html#function_uuid-to-bin">
       <code class="literal">
        UUID_TO_BIN()
       </code>
      </a>
      :
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa7727907"><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">HEX</span><span class="token punctuation">(</span><span class="token function">UUID_TO_BIN</span><span class="token punctuation">(</span><span class="token variable">@uuid</span><span class="token punctuation">)</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 class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HEX(UUID_TO_BIN(@uuid))          <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>
<span class="token output"><span class="token punctuation">|</span> 6CCD780CBABA102695645B8C656024DB <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>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">UUID_TO_BIN</span><span class="token punctuation">(</span><span class="token variable">@uuid</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>
<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>
<span class="token output"><span class="token punctuation">|</span> HEX(UUID_TO_BIN(@uuid, 0))       <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>
<span class="token output"><span class="token punctuation">|</span> 6CCD780CBABA102695645B8C656024DB <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>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">UUID_TO_BIN</span><span class="token punctuation">(</span><span class="token variable">@uuid</span><span class="token punctuation">,</span> <span class="token number">1</span><span class="token punctuation">)</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 class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HEX(UUID_TO_BIN(@uuid, 1))       <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>
<span class="token output"><span class="token punctuation">|</span> 1026BABA6CCD780C95645B8C656024DB <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></code></pre>
     </div>
     <p>
      To convert a binary UUID returned by
      <a class="link" href="miscellaneous-functions.html#function_uuid-to-bin">
       <code class="literal">
        UUID_TO_BIN()
       </code>
      </a>
      to a string UUID,
          use
      <a class="link" href="miscellaneous-functions.html#function_bin-to-uuid">
       <code class="literal">
        BIN_TO_UUID()
       </code>
      </a>
      . If you
          produce a binary UUID by calling
      <a class="link" href="miscellaneous-functions.html#function_uuid-to-bin">
       <code class="literal">
        UUID_TO_BIN()
       </code>
      </a>
      with a second
          argument of 1 to swap time parts, you should also pass a
          second argument of 1 to
      <a class="link" href="miscellaneous-functions.html#function_bin-to-uuid">
       <code class="literal">
        BIN_TO_UUID()
       </code>
      </a>
      to unswap the
          time parts when converting the binary UUID back to a string
          UUID:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa18968839"><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">BIN_TO_UUID</span><span class="token punctuation">(</span><span class="token function">UUID_TO_BIN</span><span class="token punctuation">(</span><span class="token variable">@uuid</span><span class="token punctuation">)</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 class="token punctuation">-</span><span class="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> BIN_TO_UUID(UUID_TO_BIN(@uuid))      <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> 6ccd780c<span class="token punctuation">-</span>baba<span class="token punctuation">-</span>1026<span class="token punctuation">-</span>9564<span class="token punctuation">-</span>5b8c656024db <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 prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">BIN_TO_UUID</span><span class="token punctuation">(</span><span class="token function">UUID_TO_BIN</span><span class="token punctuation">(</span><span class="token variable">@uuid</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 number">0</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 class="token punctuation">-</span><span class="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> BIN_TO_UUID(UUID_TO_BIN(@uuid,0),0)  <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> 6ccd780c<span class="token punctuation">-</span>baba<span class="token punctuation">-</span>1026<span class="token punctuation">-</span>9564<span class="token punctuation">-</span>5b8c656024db <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 prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">BIN_TO_UUID</span><span class="token punctuation">(</span><span class="token function">UUID_TO_BIN</span><span class="token punctuation">(</span><span class="token variable">@uuid</span><span class="token punctuation">,</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token number">1</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 class="token punctuation">-</span><span class="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> BIN_TO_UUID(UUID_TO_BIN(@uuid,1),1)  <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> 6ccd780c<span class="token punctuation">-</span>baba<span class="token punctuation">-</span>1026<span class="token punctuation">-</span>9564<span class="token punctuation">-</span>5b8c656024db <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>
      If the use of time-part swapping is not the same for the
          conversion in both directions, the original UUID is not
          recovered properly:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa92936752"><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">BIN_TO_UUID</span><span class="token punctuation">(</span><span class="token function">UUID_TO_BIN</span><span class="token punctuation">(</span><span class="token variable">@uuid</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 number">1</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 class="token punctuation">-</span><span class="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> BIN_TO_UUID(UUID_TO_BIN(@uuid,0),1)  <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> baba1026<span class="token punctuation">-</span>780c<span class="token punctuation">-</span>6ccd<span class="token punctuation">-</span>9564<span class="token punctuation">-</span>5b8c656024db <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 prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">BIN_TO_UUID</span><span class="token punctuation">(</span><span class="token function">UUID_TO_BIN</span><span class="token punctuation">(</span><span class="token variable">@uuid</span><span class="token punctuation">,</span><span class="token number">1</span><span class="token punctuation">)</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 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> BIN_TO_UUID(UUID_TO_BIN(@uuid,1),0)  <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> 1026baba<span class="token punctuation">-</span>6ccd<span class="token punctuation">-</span>780c<span class="token punctuation">-</span>9564<span class="token punctuation">-</span>5b8c656024db <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>
      If
      <a class="link" href="miscellaneous-functions.html#function_uuid-to-bin">
       <code class="literal">
        UUID_TO_BIN()
       </code>
      </a>
      is invoked
          from within the
      <a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
       <span class="command">
        <strong>
         mysql
        </strong>
       </span>
      </a>
      client, binary
          strings display using hexadecimal notation, depending on the
          value of the
      <a class="link" href="mysql-command-options.html#option_mysql_binary-as-hex">
       <code class="option">
        --binary-as-hex
       </code>
      </a>
      .
          For more information about that option, see
      <a class="xref" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
       Section 6.5.1, “mysql — The MySQL Command-Line Client”
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <a name="function_values">
     </a>
     <p>
      <a class="link" href="miscellaneous-functions.html#function_values">
       <code class="literal">
        VALUES(
        <em class="replaceable">
         <code>
          col_name
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045190553200">
     </a>
     <p>
      In an
      <a class="link" href="insert-on-duplicate.html" title="15.2.7.2 INSERT ... ON DUPLICATE KEY UPDATE Statement">
       <code class="literal">
        INSERT
          ... ON DUPLICATE KEY UPDATE
       </code>
      </a>
      statement, you can use
          the
      <code class="literal">
       VALUES(
       <em class="replaceable">
        <code>
         col_name
        </code>
       </em>
       )
      </code>
      function in the
      <a class="link" href="update.html" title="15.2.17 UPDATE Statement">
       <code class="literal">
        UPDATE
       </code>
      </a>
      clause
          to refer to column values from the
      <a class="link" href="insert.html" title="15.2.7 INSERT Statement">
       <code class="literal">
        INSERT
       </code>
      </a>
      portion of the
          statement. In other words,
      <code class="literal">
       VALUES(
       <em class="replaceable">
        <code>
         col_name
        </code>
       </em>
       )
      </code>
      in the
      <a class="link" href="update.html" title="15.2.17 UPDATE Statement">
       <code class="literal">
        UPDATE
       </code>
      </a>
      clause refers to
          the value of
      <em class="replaceable">
       <code>
        col_name
       </code>
      </em>
      that would be
          inserted, had no duplicate-key conflict occurred. This
          function is especially useful in multiple-row inserts. The
      <a class="link" href="miscellaneous-functions.html#function_values">
       <code class="literal">
        VALUES()
       </code>
      </a>
      function is meaningful
          only in the
      <code class="literal">
       ON DUPLICATE KEY UPDATE
      </code>
      clause
          of
      <a class="link" href="insert.html" title="15.2.7 INSERT Statement">
       <code class="literal">
        INSERT
       </code>
      </a>
      statements and
          returns
      <code class="literal">
       NULL
      </code>
      otherwise. See
      <a class="xref" href="insert-on-duplicate.html" title="15.2.7.2 INSERT ... ON DUPLICATE KEY UPDATE Statement">
       Section 15.2.7.2, “INSERT ... ON DUPLICATE KEY UPDATE Statement”
      </a>
      .
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa76046886"><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">INSERT</span> <span class="token keyword">INTO</span> <span class="token keyword">table</span> <span class="token punctuation">(</span>a<span class="token punctuation">,</span>b<span class="token punctuation">,</span>c<span class="token punctuation">)</span> <span class="token keyword">VALUES</span> <span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">,</span><span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">,</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token number">6</span><span class="token punctuation">)</span>
<span class="token prompt">    -&gt;</span> <span class="token keyword">ON</span> <span class="token keyword">DUPLICATE</span> <span class="token keyword">KEY</span> <span class="token keyword">UPDATE</span> c<span class="token operator">=</span><span class="token keyword">VALUES</span><span class="token punctuation">(</span>a<span class="token punctuation">)</span><span class="token operator">+</span><span class="token keyword">VALUES</span><span class="token punctuation">(</span>b<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
     </div>
     <div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Important
      </div>
      <p>
       This usage is deprecated, and subject to removal in a future
            release of MySQL. Use a row alias, or row and column
            aliases, instead. For more information and examples, see
       <a class="xref" href="insert-on-duplicate.html" title="15.2.7.2 INSERT ... ON DUPLICATE KEY UPDATE Statement">
        Section 15.2.7.2, “INSERT ... ON DUPLICATE KEY UPDATE Statement”
       </a>
       .
      </p>
     </div>
    </li>
   </ul>
  </div>
 </div>
 <br/>
</div>
