<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h2 class="title">
      <a name="string-functions">
      </a>
      14.8 String Functions and Operators
     </h2>
    </div>
   </div>
  </div>
  <div class="toc">
   <dl class="toc">
    <dt>
     <span class="section">
      <a href="string-comparison-functions.html">
       14.8.1 String Comparison Functions and Operators
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="regexp.html">
       14.8.2 Regular Expressions
      </a>
     </span>
    </dt>
    <dt>
     <span class="section">
      <a href="string-functions-charset.html">
       14.8.3 Character Set and Collation of Function Results
      </a>
     </span>
    </dt>
   </dl>
  </div>
  <a class="indexterm" name="idm46045203861616">
  </a>
  <a class="indexterm" name="idm46045203860576">
  </a>
  <a class="indexterm" name="idm46045203859088">
  </a>
  <a class="indexterm" name="idm46045203858016">
  </a>
  <div class="table">
   <a name="idm46045203856528">
   </a>
   <p class="title">
    <b>
     Table 14.12 String Functions and Operators
    </b>
   </p>
   <div class="table-contents">
    <table frame="box" rules="all" summary="A reference that lists string functions and operators.">
     <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="string-functions.html#function_ascii">
         <code class="literal">
          ASCII()
         </code>
        </a>
       </td>
       <td>
        Return numeric value of left-most character
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_bin">
         <code class="literal">
          BIN()
         </code>
        </a>
       </td>
       <td>
        Return a string containing binary representation of a number
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_bit-length">
         <code class="literal">
          BIT_LENGTH()
         </code>
        </a>
       </td>
       <td>
        Return length of argument in bits
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_char">
         <code class="literal">
          CHAR()
         </code>
        </a>
       </td>
       <td>
        Return the character for each integer passed
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_char-length">
         <code class="literal">
          CHAR_LENGTH()
         </code>
        </a>
       </td>
       <td>
        Return number of characters in argument
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_character-length">
         <code class="literal">
          CHARACTER_LENGTH()
         </code>
        </a>
       </td>
       <td>
        Synonym for CHAR_LENGTH()
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_concat">
         <code class="literal">
          CONCAT()
         </code>
        </a>
       </td>
       <td>
        Return concatenated string
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_concat-ws">
         <code class="literal">
          CONCAT_WS()
         </code>
        </a>
       </td>
       <td>
        Return concatenate with separator
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_elt">
         <code class="literal">
          ELT()
         </code>
        </a>
       </td>
       <td>
        Return string at index number
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_export-set">
         <code class="literal">
          EXPORT_SET()
         </code>
        </a>
       </td>
       <td>
        Return a string such that for every bit set in the value bits, you
      get an on string and for every unset bit, you get an off string
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_field">
         <code class="literal">
          FIELD()
         </code>
        </a>
       </td>
       <td>
        Index (position) of first argument in subsequent arguments
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_find-in-set">
         <code class="literal">
          FIND_IN_SET()
         </code>
        </a>
       </td>
       <td>
        Index (position) of first argument within second argument
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_format">
         <code class="literal">
          FORMAT()
         </code>
        </a>
       </td>
       <td>
        Return a number formatted to specified number of decimal places
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_hex">
         <code class="literal">
          HEX()
         </code>
        </a>
       </td>
       <td>
        Hexadecimal representation of decimal or string value
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_insert">
         <code class="literal">
          INSERT()
         </code>
        </a>
       </td>
       <td>
        Insert substring at specified position up to specified number of
      characters
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_instr">
         <code class="literal">
          INSTR()
         </code>
        </a>
       </td>
       <td>
        Return the index of the first occurrence of substring
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_lcase">
         <code class="literal">
          LCASE()
         </code>
        </a>
       </td>
       <td>
        Synonym for LOWER()
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_left">
         <code class="literal">
          LEFT()
         </code>
        </a>
       </td>
       <td>
        Return the leftmost number of characters as specified
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_length">
         <code class="literal">
          LENGTH()
         </code>
        </a>
       </td>
       <td>
        Return the length of a string in bytes
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-comparison-functions.html#operator_like">
         <code class="literal">
          LIKE
         </code>
        </a>
       </td>
       <td>
        Simple pattern matching
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_load-file">
         <code class="literal">
          LOAD_FILE()
         </code>
        </a>
       </td>
       <td>
        Load the named file
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_locate">
         <code class="literal">
          LOCATE()
         </code>
        </a>
       </td>
       <td>
        Return the position of the first occurrence of substring
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_lower">
         <code class="literal">
          LOWER()
         </code>
        </a>
       </td>
       <td>
        Return the argument in lowercase
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_lpad">
         <code class="literal">
          LPAD()
         </code>
        </a>
       </td>
       <td>
        Return the string argument, left-padded with the specified string
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_ltrim">
         <code class="literal">
          LTRIM()
         </code>
        </a>
       </td>
       <td>
        Remove leading spaces
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_make-set">
         <code class="literal">
          MAKE_SET()
         </code>
        </a>
       </td>
       <td>
        Return a set of comma-separated strings that have the
      corresponding bit in bits set
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="fulltext-search.html#function_match">
         <code class="literal">
          MATCH()
         </code>
        </a>
       </td>
       <td>
        Perform full-text search
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_mid">
         <code class="literal">
          MID()
         </code>
        </a>
       </td>
       <td>
        Return a substring starting from the specified position
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-comparison-functions.html#operator_not-like">
         <code class="literal">
          NOT LIKE
         </code>
        </a>
       </td>
       <td>
        Negation of simple pattern matching
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="regexp.html#operator_not-regexp">
         <code class="literal">
          NOT REGEXP
         </code>
        </a>
       </td>
       <td>
        Negation of REGEXP
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_oct">
         <code class="literal">
          OCT()
         </code>
        </a>
       </td>
       <td>
        Return a string containing octal representation of a number
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_octet-length">
         <code class="literal">
          OCTET_LENGTH()
         </code>
        </a>
       </td>
       <td>
        Synonym for LENGTH()
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_ord">
         <code class="literal">
          ORD()
         </code>
        </a>
       </td>
       <td>
        Return character code for leftmost character of the argument
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_position">
         <code class="literal">
          POSITION()
         </code>
        </a>
       </td>
       <td>
        Synonym for LOCATE()
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_quote">
         <code class="literal">
          QUOTE()
         </code>
        </a>
       </td>
       <td>
        Escape the argument for use in an SQL statement
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="regexp.html#operator_regexp">
         <code class="literal">
          REGEXP
         </code>
        </a>
       </td>
       <td>
        Whether string matches regular expression
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="regexp.html#function_regexp-instr">
         <code class="literal">
          REGEXP_INSTR()
         </code>
        </a>
       </td>
       <td>
        Starting index of substring matching regular expression
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="regexp.html#function_regexp-like">
         <code class="literal">
          REGEXP_LIKE()
         </code>
        </a>
       </td>
       <td>
        Whether string matches regular expression
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="regexp.html#function_regexp-replace">
         <code class="literal">
          REGEXP_REPLACE()
         </code>
        </a>
       </td>
       <td>
        Replace substrings matching regular expression
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="regexp.html#function_regexp-substr">
         <code class="literal">
          REGEXP_SUBSTR()
         </code>
        </a>
       </td>
       <td>
        Return substring matching regular expression
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_repeat">
         <code class="literal">
          REPEAT()
         </code>
        </a>
       </td>
       <td>
        Repeat a string the specified number of times
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_replace">
         <code class="literal">
          REPLACE()
         </code>
        </a>
       </td>
       <td>
        Replace occurrences of a specified string
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_reverse">
         <code class="literal">
          REVERSE()
         </code>
        </a>
       </td>
       <td>
        Reverse the characters in a string
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_right">
         <code class="literal">
          RIGHT()
         </code>
        </a>
       </td>
       <td>
        Return the specified rightmost number of characters
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="regexp.html#operator_regexp">
         <code class="literal">
          RLIKE
         </code>
        </a>
       </td>
       <td>
        Whether string matches regular expression
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_rpad">
         <code class="literal">
          RPAD()
         </code>
        </a>
       </td>
       <td>
        Append string the specified number of times
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_rtrim">
         <code class="literal">
          RTRIM()
         </code>
        </a>
       </td>
       <td>
        Remove trailing spaces
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_soundex">
         <code class="literal">
          SOUNDEX()
         </code>
        </a>
       </td>
       <td>
        Return a soundex string
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#operator_sounds-like">
         <code class="literal">
          SOUNDS LIKE
         </code>
        </a>
       </td>
       <td>
        Compare sounds
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_space">
         <code class="literal">
          SPACE()
         </code>
        </a>
       </td>
       <td>
        Return a string of the specified number of spaces
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-comparison-functions.html#function_strcmp">
         <code class="literal">
          STRCMP()
         </code>
        </a>
       </td>
       <td>
        Compare two strings
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_substr">
         <code class="literal">
          SUBSTR()
         </code>
        </a>
       </td>
       <td>
        Return the substring as specified
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_substring">
         <code class="literal">
          SUBSTRING()
         </code>
        </a>
       </td>
       <td>
        Return the substring as specified
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_substring-index">
         <code class="literal">
          SUBSTRING_INDEX()
         </code>
        </a>
       </td>
       <td>
        Return a substring from a string before the specified number of
      occurrences of the delimiter
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_trim">
         <code class="literal">
          TRIM()
         </code>
        </a>
       </td>
       <td>
        Remove leading and trailing spaces
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_ucase">
         <code class="literal">
          UCASE()
         </code>
        </a>
       </td>
       <td>
        Synonym for UPPER()
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_unhex">
         <code class="literal">
          UNHEX()
         </code>
        </a>
       </td>
       <td>
        Return a string containing hex representation of a number
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_upper">
         <code class="literal">
          UPPER()
         </code>
        </a>
       </td>
       <td>
        Convert to uppercase
       </td>
      </tr>
      <tr>
       <td>
        <a class="link" href="string-functions.html#function_weight-string">
         <code class="literal">
          WEIGHT_STRING()
         </code>
        </a>
       </td>
       <td>
        Return the weight string for a string
       </td>
      </tr>
     </tbody>
    </table>
   </div>
   <div class="table-contents">
    <table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 401px; width: 739px;">
     <thead>
      <tr>
       <th style="width: 208.719px;">
        Name
       </th>
       <th style="width: 529.281px;">
        Description
       </th>
      </tr>
     </thead>
    </table>
   </div>
  </div>
  <br class="table-break"/>
  <p>
   String-valued functions return
   <code class="literal">
    NULL
   </code>
   if the
      length of the result would be greater than the value of the
   <a class="link" href="server-system-variables.html#sysvar_max_allowed_packet">
    <code class="literal">
     max_allowed_packet
    </code>
   </a>
   system
      variable. See
   <a class="xref" href="server-configuration.html" title="7.1.1 Configuring the Server">
    Section 7.1.1, “Configuring the Server”
   </a>
   .
  </p>
  <p>
   For functions that operate on string positions, the first position
      is numbered 1.
  </p>
  <p>
   For functions that take length arguments, noninteger arguments are
      rounded to the nearest integer.
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <a name="function_ascii">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_ascii">
       <code class="literal">
        ASCII(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203663648">
     </a>
     <p>
      Returns the numeric value of the leftmost character of the
          string
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      . Returns
      <code class="literal">
       0
      </code>
      if
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      is the
          empty string. Returns
      <code class="literal">
       NULL
      </code>
      if
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      is
      <code class="literal">
       NULL
      </code>
      .
      <a class="link" href="string-functions.html#function_ascii">
       <code class="literal">
        ASCII()
       </code>
      </a>
      works for 8-bit
          characters.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa31156887"><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">ASCII</span><span class="token punctuation">(</span><span class="token string">'2'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token number">50</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">ASCII</span><span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token number">50</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">ASCII</span><span class="token punctuation">(</span><span class="token string">'dx'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token number">100</span></code></pre>
     </div>
     <p>
      See also the
      <a class="link" href="string-functions.html#function_ord">
       <code class="literal">
        ORD()
       </code>
      </a>
      function.
     </p>
    </li>
    <li class="listitem">
     <a name="function_bin">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_bin">
       <code class="literal">
        BIN(
        <em class="replaceable">
         <code>
          N
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203645744">
     </a>
     <p>
      Returns a string representation of the binary value of
      <em class="replaceable">
       <code>
        N
       </code>
      </em>
      , where
      <em class="replaceable">
       <code>
        N
       </code>
      </em>
      is a longlong
          (
      <a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
       <code class="literal">
        BIGINT
       </code>
      </a>
      ) number. This is
          equivalent to
      <a class="link" href="mathematical-functions.html#function_conv">
       <code class="literal">
        CONV(
        <em class="replaceable">
         <code>
          N
         </code>
        </em>
        ,10,2)
       </code>
      </a>
      .
          Returns
      <code class="literal">
       NULL
      </code>
      if
      <em class="replaceable">
       <code>
        N
       </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="sa41947838"><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</span><span class="token punctuation">(</span><span class="token number">12</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'1100'</span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_bit-length">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_bit-length">
       <code class="literal">
        BIT_LENGTH(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203630000">
     </a>
     <p>
      Returns the length of the string
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      in bits. Returns
      <code class="literal">
       NULL
      </code>
      if
      <em class="replaceable">
       <code>
        str
       </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="sa83399248"><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">BIT_LENGTH</span><span class="token punctuation">(</span><span class="token string">'text'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token number">32</span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_char">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_char">
       <code class="literal">
        CHAR(
        <em class="replaceable">
         <code>
          N
         </code>
        </em>
        ,...
          [USING
        <em class="replaceable">
         <code>
          charset_name
         </code>
        </em>
        ])
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203617216">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_char">
       <code class="literal">
        CHAR()
       </code>
      </a>
      interprets each argument
      <em class="replaceable">
       <code>
        N
       </code>
      </em>
      as an integer and returns a
          string consisting of the characters given by the code values
          of those integers.
      <code class="literal">
       NULL
      </code>
      values are skipped.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa26148689"><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 datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">77</span><span class="token punctuation">,</span><span class="token number">121</span><span class="token punctuation">,</span><span class="token number">83</span><span class="token punctuation">,</span><span class="token number">81</span><span class="token punctuation">,</span><span class="token string">'76'</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>
<span class="token output"><span class="token punctuation">|</span> CHAR(77,121,83,81,'76')                          <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>
<span class="token output"><span class="token punctuation">|</span> 0x4D7953514C                                     <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>
<span class="token output">1 row in set (0.00 sec)</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">77</span><span class="token punctuation">,</span><span class="token number">77.3</span><span class="token punctuation">,</span><span class="token string">'77.3'</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>
<span class="token output"><span class="token punctuation">|</span> CHAR(77,77.3,'77.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>
<span class="token output"><span class="token punctuation">|</span> 0x4D4D4D                                   <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>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
     </div>
     <p>
      By default,
      <a class="link" href="string-functions.html#function_char">
       <code class="literal">
        CHAR()
       </code>
      </a>
      returns a
          binary string. To produce a string in a given character set,
          use the optional
      <code class="literal">
       USING
      </code>
      clause:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa66274730"><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 datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">77</span><span class="token punctuation">,</span><span class="token number">121</span><span class="token punctuation">,</span><span class="token number">83</span><span class="token punctuation">,</span><span class="token number">81</span><span class="token punctuation">,</span><span class="token string">'76'</span> <span class="token keyword">USING</span> utf8mb4<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>
<span class="token output"><span class="token punctuation">|</span> CHAR(77,121,83,81,'76' USING utf8mb4) <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>
<span class="token output"><span class="token punctuation">|</span> MySQL                                 <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>
<span class="token output">1 row in set (0.00 sec)</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">77</span><span class="token punctuation">,</span><span class="token number">77.3</span><span class="token punctuation">,</span><span class="token string">'77.3'</span> <span class="token keyword">USING</span> utf8mb4<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>
<span class="token output"><span class="token punctuation">|</span> CHAR(77,77.3,'77.3' USING utf8mb4) <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>
<span class="token output"><span class="token punctuation">|</span> MMM                                <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>
<span class="token output">1 row in set, 1 warning (0.00 sec)</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SHOW</span> <span class="token keyword">WARNINGS</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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Level   <span class="token punctuation">|</span> Code <span class="token punctuation">|</span> Message                                   <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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Warning <span class="token punctuation">|</span> 1292 <span class="token punctuation">|</span> Truncated incorrect INTEGER value: '77.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 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>
      If
      <code class="literal">
       USING
      </code>
      is given and the result string is
          illegal for the given character set, a warning is issued.
          Also, if strict SQL mode is enabled, the result from
      <a class="link" href="string-functions.html#function_char">
       <code class="literal">
        CHAR()
       </code>
      </a>
      becomes
      <code class="literal">
       NULL
      </code>
      .
     </p>
     <p>
      If
      <a class="link" href="string-functions.html#function_char">
       <code class="literal">
        CHAR()
       </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>
     <p>
      <a class="link" href="string-functions.html#function_char">
       <code class="literal">
        CHAR()
       </code>
      </a>
      arguments larger than
          255 are converted into multiple result bytes. For example,
      <a class="link" href="string-functions.html#function_char">
       <code class="literal">
        CHAR(256)
       </code>
      </a>
      is equivalent to
      <a class="link" href="string-functions.html#function_char">
       <code class="literal">
        CHAR(1,0)
       </code>
      </a>
      , and
      <a class="link" href="string-functions.html#function_char">
       <code class="literal">
        CHAR(256*256)
       </code>
      </a>
      is equivalent to
      <a class="link" href="string-functions.html#function_char">
       <code class="literal">
        CHAR(1,0,0)
       </code>
      </a>
      :
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa54454773"><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 datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">1</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 function">HEX</span><span class="token punctuation">(</span><span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">256</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>
<span class="token output"><span class="token punctuation">|</span> HEX(CHAR(1,0)) <span class="token punctuation">|</span> HEX(CHAR(256)) <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>
<span class="token output"><span class="token punctuation">|</span> 0100           <span class="token punctuation">|</span> 0100           <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>
<span class="token output">1 row in set (0.00 sec)</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 datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">256</span><span class="token operator">*</span><span class="token number">256</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 class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> HEX(CHAR(1,0,0)) <span class="token punctuation">|</span> HEX(CHAR(256*256)) <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>
<span class="token output"><span class="token punctuation">|</span> 010000           <span class="token punctuation">|</span> 010000             <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>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_char-length">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_char-length">
       <code class="literal">
        CHAR_LENGTH(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203577584">
     </a>
     <p>
      Returns the length of the string
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      , measured in code points. A
          multibyte character counts as a single code point. This means
          that, for a string containing two 3-byte characters,
      <a class="link" href="string-functions.html#function_length">
       <code class="literal">
        LENGTH()
       </code>
      </a>
      returns
      <code class="literal">
       6
      </code>
      , whereas
      <a class="link" href="string-functions.html#function_char-length">
       <code class="literal">
        CHAR_LENGTH()
       </code>
      </a>
      returns
      <code class="literal">
       2
      </code>
      , as shown here:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa98571729"><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">@dolphin</span><span class="token operator">:=</span><span class="token string">'海豚'</span><span class="token punctuation">;</span>
<span class="token output">Query OK, 0 rows affected (0.01 sec)</span>

<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">LENGTH</span><span class="token punctuation">(</span><span class="token variable">@dolphin</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">CHAR_LENGTH</span><span class="token punctuation">(</span><span class="token variable">@dolphin</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>
<span class="token output"><span class="token punctuation">|</span> LENGTH(@dolphin) <span class="token punctuation">|</span> CHAR_LENGTH(@dolphin) <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>
<span class="token output"><span class="token punctuation">|</span>                6 <span class="token punctuation">|</span>                     2 <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>
<span class="token output">1 row in set (0.00 sec)</span></code></pre>
     </div>
     <p>
      <code class="literal">
       CHAR_LENGTH()
      </code>
      returns
      <code class="literal">
       NULL
      </code>
      if
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      is
      <code class="literal">
       NULL
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <a name="function_character-length">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_character-length">
       <code class="literal">
        CHARACTER_LENGTH(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203559472">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_character-length">
       <code class="literal">
        CHARACTER_LENGTH()
       </code>
      </a>
      is a synonym
          for
      <a class="link" href="string-functions.html#function_char-length">
       <code class="literal">
        CHAR_LENGTH()
       </code>
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <a name="function_concat">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_concat">
       <code class="literal">
        CONCAT(
        <em class="replaceable">
         <code>
          str1
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          str2
         </code>
        </em>
        ,...)
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203548672">
     </a>
     <a class="indexterm" name="idm46045203547600">
     </a>
     <a class="indexterm" name="idm46045203546528">
     </a>
     <p>
      Returns the string that results from concatenating the
          arguments. May have one or more arguments. If all arguments
          are nonbinary strings, the result is a nonbinary string. If
          the arguments include any binary strings, the result is a
          binary string. A numeric argument is converted to its
          equivalent nonbinary string form.
     </p>
     <p>
      <a class="link" href="string-functions.html#function_concat">
       <code class="literal">
        CONCAT()
       </code>
      </a>
      returns
      <code class="literal">
       NULL
      </code>
      if any argument is
      <code class="literal">
       NULL
      </code>
      .
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa38575174"><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">CONCAT</span><span class="token punctuation">(</span><span class="token string">'My'</span><span class="token punctuation">,</span> <span class="token string">'S'</span><span class="token punctuation">,</span> <span class="token string">'QL'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'MySQL'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">CONCAT</span><span class="token punctuation">(</span><span class="token string">'My'</span><span class="token punctuation">,</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span> <span class="token string">'QL'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token boolean">NULL</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">CONCAT</span><span class="token punctuation">(</span><span class="token number">14.3</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'14.3'</span></code></pre>
     </div>
     <p>
      For quoted strings, concatenation can be performed by placing
          the strings next to each other:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa9883458"><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 string">'My'</span> <span class="token string">'S'</span> <span class="token string">'QL'</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'MySQL'</span></code></pre>
     </div>
     <p>
      If
      <a class="link" href="string-functions.html#function_concat">
       <code class="literal">
        CONCAT()
       </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 string
          results 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_concat-ws">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_concat-ws">
       <code class="literal">
        CONCAT_WS(
        <em class="replaceable">
         <code>
          separator
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          str1
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          str2
         </code>
        </em>
        ,...)
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203523264">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_concat-ws">
       <code class="literal">
        CONCAT_WS()
       </code>
      </a>
      stands for
          Concatenate With Separator and is a special form of
      <a class="link" href="string-functions.html#function_concat">
       <code class="literal">
        CONCAT()
       </code>
      </a>
      . The first argument is
          the separator for the rest of the arguments. The separator is
          added between the strings to be concatenated. The separator
          can be a string, as can the rest of the arguments. If the
          separator is
      <code class="literal">
       NULL
      </code>
      , the result is
      <code class="literal">
       NULL
      </code>
      .
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa61882483"><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">CONCAT_WS</span><span class="token punctuation">(</span><span class="token string">','</span><span class="token punctuation">,</span> <span class="token string">'First name'</span><span class="token punctuation">,</span> <span class="token string">'Second name'</span><span class="token punctuation">,</span> <span class="token string">'Last Name'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'First name,Second name,Last Name'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">CONCAT_WS</span><span class="token punctuation">(</span><span class="token string">','</span><span class="token punctuation">,</span> <span class="token string">'First name'</span><span class="token punctuation">,</span> <span class="token boolean">NULL</span><span class="token punctuation">,</span> <span class="token string">'Last Name'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'First name,Last Name'</span></code></pre>
     </div>
     <p>
      <a class="link" href="string-functions.html#function_concat-ws">
       <code class="literal">
        CONCAT_WS()
       </code>
      </a>
      does not skip empty
          strings. However, it does skip any
      <code class="literal">
       NULL
      </code>
      values after the separator argument.
     </p>
    </li>
    <li class="listitem">
     <a name="function_elt">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_elt">
       <code class="literal">
        ELT(
        <em class="replaceable">
         <code>
          N
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          str1
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          str2
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          str3
         </code>
        </em>
        ,...)
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203504304">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_elt">
       <code class="literal">
        ELT()
       </code>
      </a>
      returns the
      <em class="replaceable">
       <code>
        N
       </code>
      </em>
      th element of the list of strings:
      <em class="replaceable">
       <code>
        str1
       </code>
      </em>
      if
      <em class="replaceable">
       <code>
        N
       </code>
      </em>
      =
      <code class="literal">
       1
      </code>
      ,
      <em class="replaceable">
       <code>
        str2
       </code>
      </em>
      if
      <em class="replaceable">
       <code>
        N
       </code>
      </em>
      =
      <code class="literal">
       2
      </code>
      , and so
          on. Returns
      <code class="literal">
       NULL
      </code>
      if
      <em class="replaceable">
       <code>
        N
       </code>
      </em>
      is less than
      <code class="literal">
       1
      </code>
      , greater than the number of arguments, or
      <code class="literal">
       NULL
      </code>
      .
      <a class="link" href="string-functions.html#function_elt">
       <code class="literal">
        ELT()
       </code>
      </a>
      is the complement of
      <a class="link" href="string-functions.html#function_field">
       <code class="literal">
        FIELD()
       </code>
      </a>
      .
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa55604232"><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">ELT</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token string">'Aa'</span><span class="token punctuation">,</span> <span class="token string">'Bb'</span><span class="token punctuation">,</span> <span class="token string">'Cc'</span><span class="token punctuation">,</span> <span class="token string">'Dd'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'Aa'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">ELT</span><span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">,</span> <span class="token string">'Aa'</span><span class="token punctuation">,</span> <span class="token string">'Bb'</span><span class="token punctuation">,</span> <span class="token string">'Cc'</span><span class="token punctuation">,</span> <span class="token string">'Dd'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'Dd'</span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_export-set">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_export-set">
       <code class="literal">
        EXPORT_SET(
        <em class="replaceable">
         <code>
          bits
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          on
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          off
         </code>
        </em>
        [,
        <em class="replaceable">
         <code>
          separator
         </code>
        </em>
        [,
        <em class="replaceable">
         <code>
          number_of_bits
         </code>
        </em>
        ]])
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203482096">
     </a>
     <p>
      Returns a string such that for every bit set in the value
      <em class="replaceable">
       <code>
        bits
       </code>
      </em>
      , you get an
      <em class="replaceable">
       <code>
        on
       </code>
      </em>
      string and for every bit not set
          in the value, you get an
      <em class="replaceable">
       <code>
        off
       </code>
      </em>
      string. Bits in
      <em class="replaceable">
       <code>
        bits
       </code>
      </em>
      are examined
          from right to left (from low-order to high-order bits).
          Strings are added to the result from left to right, separated
          by the
      <em class="replaceable">
       <code>
        separator
       </code>
      </em>
      string (the
          default being the comma character
      <code class="literal">
       ,
      </code>
      ). The
          number of bits examined is given by
      <em class="replaceable">
       <code>
        number_of_bits
       </code>
      </em>
      , which has a default
          of 64 if not specified.
      <em class="replaceable">
       <code>
        number_of_bits
       </code>
      </em>
      is silently clipped
          to 64 if larger than 64. It is treated as an unsigned integer,
          so a value of −1 is effectively the same as 64.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa3953900"><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">EXPORT_SET</span><span class="token punctuation">(</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token string">'Y'</span><span class="token punctuation">,</span><span class="token string">'N'</span><span class="token punctuation">,</span><span class="token string">','</span><span class="token punctuation">,</span><span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'Y,N,Y,N'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">EXPORT_SET</span><span class="token punctuation">(</span><span class="token number">6</span><span class="token punctuation">,</span><span class="token string">'1'</span><span class="token punctuation">,</span><span class="token string">'0'</span><span class="token punctuation">,</span><span class="token string">','</span><span class="token punctuation">,</span><span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'0,1,1,0,0,0,0,0,0,0'</span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_field">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_field">
       <code class="literal">
        FIELD(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          str1
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          str2
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          str3
         </code>
        </em>
        ,...)
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203465360">
     </a>
     <p>
      Returns the index (position) of
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      in the
      <em class="replaceable">
       <code>
        str1
       </code>
      </em>
      ,
      <em class="replaceable">
       <code>
        str2
       </code>
      </em>
      ,
      <em class="replaceable">
       <code>
        str3
       </code>
      </em>
      ,
      <code class="literal">
       ...
      </code>
      list.
          Returns
      <code class="literal">
       0
      </code>
      if
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      is not found.
     </p>
     <p>
      If all arguments to
      <a class="link" href="string-functions.html#function_field">
       <code class="literal">
        FIELD()
       </code>
      </a>
      are
          strings, all arguments are compared as strings. If all
          arguments are numbers, they are compared as numbers.
          Otherwise, the arguments are compared as double.
     </p>
     <p>
      If
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      is
      <code class="literal">
       NULL
      </code>
      ,
          the return value is
      <code class="literal">
       0
      </code>
      because
      <code class="literal">
       NULL
      </code>
      fails equality comparison with any
          value.
      <a class="link" href="string-functions.html#function_field">
       <code class="literal">
        FIELD()
       </code>
      </a>
      is the
          complement of
      <a class="link" href="string-functions.html#function_elt">
       <code class="literal">
        ELT()
       </code>
      </a>
      .
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa50455261"><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">FIELD</span><span class="token punctuation">(</span><span class="token string">'Bb'</span><span class="token punctuation">,</span> <span class="token string">'Aa'</span><span class="token punctuation">,</span> <span class="token string">'Bb'</span><span class="token punctuation">,</span> <span class="token string">'Cc'</span><span class="token punctuation">,</span> <span class="token string">'Dd'</span><span class="token punctuation">,</span> <span class="token string">'Ff'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token number">2</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">FIELD</span><span class="token punctuation">(</span><span class="token string">'Gg'</span><span class="token punctuation">,</span> <span class="token string">'Aa'</span><span class="token punctuation">,</span> <span class="token string">'Bb'</span><span class="token punctuation">,</span> <span class="token string">'Cc'</span><span class="token punctuation">,</span> <span class="token string">'Dd'</span><span class="token punctuation">,</span> <span class="token string">'Ff'</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>
    </li>
    <li class="listitem">
     <a name="function_find-in-set">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_find-in-set">
       <code class="literal">
        FIND_IN_SET(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          strlist
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203443168">
     </a>
     <p>
      Returns a value in the range of 1 to
      <em class="replaceable">
       <code>
        N
       </code>
      </em>
      if the string
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      is in the string list
      <em class="replaceable">
       <code>
        strlist
       </code>
      </em>
      consisting of
      <em class="replaceable">
       <code>
        N
       </code>
      </em>
      substrings. A string list is a
          string composed of substrings separated by
      <code class="literal">
       ,
      </code>
      characters. If the first argument is a
          constant string and the second is a column of type
      <a class="link" href="set.html" title="13.3.6 The SET Type">
       <code class="literal">
        SET
       </code>
      </a>
      , the
      <a class="link" href="string-functions.html#function_find-in-set">
       <code class="literal">
        FIND_IN_SET()
       </code>
      </a>
      function is
          optimized to use bit arithmetic. Returns
      <code class="literal">
       0
      </code>
      if
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      is not in
      <em class="replaceable">
       <code>
        strlist
       </code>
      </em>
      or if
      <em class="replaceable">
       <code>
        strlist
       </code>
      </em>
      is the empty string.
          Returns
      <code class="literal">
       NULL
      </code>
      if either argument is
      <code class="literal">
       NULL
      </code>
      . This function does not work properly
          if the first argument contains a comma (
      <code class="literal">
       ,
      </code>
      )
          character.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa93561666"><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">FIND_IN_SET</span><span class="token punctuation">(</span><span class="token string">'b'</span><span class="token punctuation">,</span><span class="token string">'a,b,c,d'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token number">2</span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_format">
     </a>
     <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>
        [,
        <em class="replaceable">
         <code>
          locale
         </code>
        </em>
        ])
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203422912">
     </a>
     <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. If
      <em class="replaceable">
       <code>
        D
       </code>
      </em>
      is
      <code class="literal">
       0
      </code>
      , the result has no decimal point or
          fractional part. If
      <em class="replaceable">
       <code>
        X
       </code>
      </em>
      or
      <em class="replaceable">
       <code>
        D
       </code>
      </em>
      is
      <code class="literal">
       NULL
      </code>
      , the
          function returns
      <code class="literal">
       NULL
      </code>
      .
     </p>
     <p>
      The optional third parameter enables a locale to be specified
          to be used for the result number's decimal point, thousands
          separator, and grouping between separators. Permissible locale
          values are the same as the legal values for the
      <a class="link" href="server-system-variables.html#sysvar_lc_time_names">
       <code class="literal">
        lc_time_names
       </code>
      </a>
      system variable
          (see
      <a class="xref" href="locale-support.html" title="12.16 MySQL Server Locale Support">
       Section 12.16, “MySQL Server Locale Support”
      </a>
      ). If the locale is
      <code class="literal">
       NULL
      </code>
      or not specified, the default locale
          is
      <code class="literal">
       'en_US'
      </code>
      .
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa81662557"><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">FORMAT</span><span class="token punctuation">(</span><span class="token number">12332.123456</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'12,332.1235'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">FORMAT</span><span class="token punctuation">(</span><span class="token number">12332.1</span><span class="token punctuation">,</span><span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'12,332.1000'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">FORMAT</span><span class="token punctuation">(</span><span class="token number">12332.2</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 prompt">        -&gt;</span> <span class="token string">'12,332'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">FORMAT</span><span class="token punctuation">(</span><span class="token number">12332.2</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">,</span><span class="token string">'de_DE'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'12.332,20'</span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_from-base64">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_from-base64">
       <code class="literal">
        FROM_BASE64(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203401024">
     </a>
     <p>
      Takes a string encoded with the base-64 encoded rules used by
      <a class="link" href="string-functions.html#function_to-base64">
       <code class="literal">
        TO_BASE64()
       </code>
      </a>
      and returns the
          decoded result as a binary string. The result is
      <code class="literal">
       NULL
      </code>
      if the argument is
      <code class="literal">
       NULL
      </code>
      or not a valid base-64 string. See the
          description of
      <a class="link" href="string-functions.html#function_to-base64">
       <code class="literal">
        TO_BASE64()
       </code>
      </a>
      for
          details about the encoding and decoding rules.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa52073285"><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">TO_BASE64</span><span class="token punctuation">(</span><span class="token string">'abc'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">FROM_BASE64</span><span class="token punctuation">(</span><span class="token function">TO_BASE64</span><span class="token punctuation">(</span><span class="token string">'abc'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'JWJj'</span><span class="token punctuation">,</span> <span class="token string">'abc'</span></code></pre>
     </div>
     <p>
      If
      <a class="link" href="string-functions.html#function_from-base64">
       <code class="literal">
        FROM_BASE64()
       </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. You can disable
          this behavior by setting 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>
      to
      <code class="literal">
       0
      </code>
      when starting 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. 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_hex">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_hex">
       <code class="literal">
        HEX(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
      ,
      <a class="link" href="string-functions.html#function_hex">
       <code class="literal">
        HEX(
        <em class="replaceable">
         <code>
          N
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203378256">
     </a>
     <p>
      For a string argument
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      ,
      <a class="link" href="string-functions.html#function_hex">
       <code class="literal">
        HEX()
       </code>
      </a>
      returns a hexadecimal
          string representation of
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      where
          each byte of each character in
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      is converted to two hexadecimal digits. (Multibyte characters
          therefore become more than two digits.) The inverse of this
          operation is performed by the
      <a class="link" href="string-functions.html#function_unhex">
       <code class="literal">
        UNHEX()
       </code>
      </a>
      function.
     </p>
     <p>
      For a numeric argument
      <em class="replaceable">
       <code>
        N
       </code>
      </em>
      ,
      <a class="link" href="string-functions.html#function_hex">
       <code class="literal">
        HEX()
       </code>
      </a>
      returns a hexadecimal
          string representation of the value of
      <em class="replaceable">
       <code>
        N
       </code>
      </em>
      treated as a longlong
          (
      <a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
       <code class="literal">
        BIGINT
       </code>
      </a>
      ) number. This is
          equivalent to
      <a class="link" href="mathematical-functions.html#function_conv">
       <code class="literal">
        CONV(
        <em class="replaceable">
         <code>
          N
         </code>
        </em>
        ,10,16)
       </code>
      </a>
      .
          The inverse of this operation is performed by
      <a class="link" href="mathematical-functions.html#function_conv">
       <code class="literal">
        CONV(HEX(
        <em class="replaceable">
         <code>
          N
         </code>
        </em>
        ),16,10)
       </code>
      </a>
      .
     </p>
     <p>
      For a
      <code class="literal">
       NULL
      </code>
      argument, this function returns
      <code class="literal">
       NULL
      </code>
      .
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa15750629"><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> X<span class="token string">'616263'</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token string">'abc'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">UNHEX</span><span class="token punctuation">(</span><span class="token function">HEX</span><span class="token punctuation">(</span><span class="token string">'abc'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'abc'</span><span class="token punctuation">,</span> <span class="token number">616263</span><span class="token punctuation">,</span> <span class="token string">'abc'</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 number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">CONV</span><span class="token punctuation">(</span><span class="token function">HEX</span><span class="token punctuation">(</span><span class="token number">255</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token number">16</span><span class="token punctuation">,</span><span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'FF'</span><span class="token punctuation">,</span> <span class="token number">255</span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_insert">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_insert">
       <code class="literal">
        INSERT(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          pos
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          len
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          newstr
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203353056">
     </a>
     <p>
      Returns the string
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      , with the
          substring beginning at position
      <em class="replaceable">
       <code>
        pos
       </code>
      </em>
      and
      <em class="replaceable">
       <code>
        len
       </code>
      </em>
      characters long replaced by
          the string
      <em class="replaceable">
       <code>
        newstr
       </code>
      </em>
      . Returns the
          original string if
      <em class="replaceable">
       <code>
        pos
       </code>
      </em>
      is not
          within the length of the string. Replaces the rest of the
          string from position
      <em class="replaceable">
       <code>
        pos
       </code>
      </em>
      if
      <em class="replaceable">
       <code>
        len
       </code>
      </em>
      is not within the length of the
          rest of the string. Returns
      <code class="literal">
       NULL
      </code>
      if any
          argument is
      <code class="literal">
       NULL
      </code>
      .
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa73142661"><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">INSERT</span><span class="token punctuation">(</span><span class="token string">'Quadratic'</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token string">'What'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'QuWhattic'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">INSERT</span><span class="token punctuation">(</span><span class="token string">'Quadratic'</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 number">4</span><span class="token punctuation">,</span> <span class="token string">'What'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'Quadratic'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">INSERT</span><span class="token punctuation">(</span><span class="token string">'Quadratic'</span><span class="token punctuation">,</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token number">100</span><span class="token punctuation">,</span> <span class="token string">'What'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'QuWhat'</span></code></pre>
     </div>
     <p>
      This function is multibyte safe.
     </p>
    </li>
    <li class="listitem">
     <a name="function_instr">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_instr">
       <code class="literal">
        INSTR(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          substr
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203335808">
     </a>
     <p>
      Returns the position of the first occurrence of substring
      <em class="replaceable">
       <code>
        substr
       </code>
      </em>
      in string
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      . This is the same as the
          two-argument form of
      <a class="link" href="string-functions.html#function_locate">
       <code class="literal">
        LOCATE()
       </code>
      </a>
      ,
          except that the order of the arguments is reversed.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa14279875"><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">INSTR</span><span class="token punctuation">(</span><span class="token string">'foobarbar'</span><span class="token punctuation">,</span> <span class="token string">'bar'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token number">4</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">INSTR</span><span class="token punctuation">(</span><span class="token string">'xbar'</span><span class="token punctuation">,</span> <span class="token string">'foobar'</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>
      This function is multibyte safe, and is case-sensitive only if
          at least one argument is a binary string. If either argument
          is
      <code class="literal">
       NULL
      </code>
      , this functions returns
      <code class="literal">
       NULL
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <a name="function_lcase">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_lcase">
       <code class="literal">
        LCASE(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203320704">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_lcase">
       <code class="literal">
        LCASE()
       </code>
      </a>
      is a synonym for
      <a class="link" href="string-functions.html#function_lower">
       <code class="literal">
        LOWER()
       </code>
      </a>
      .
     </p>
     <p>
      <code class="literal">
       LCASE()
      </code>
      used in a view is rewritten as
      <code class="literal">
       LOWER()
      </code>
      when storing the view's
          definition. (Bug #12844279)
     </p>
    </li>
    <li class="listitem">
     <a name="function_left">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_left">
       <code class="literal">
        LEFT(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          len
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203308080">
     </a>
     <p>
      Returns the leftmost
      <em class="replaceable">
       <code>
        len
       </code>
      </em>
      characters
          from the string
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      , or
      <code class="literal">
       NULL
      </code>
      if any argument is
      <code class="literal">
       NULL
      </code>
      .
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa35155509"><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">LEFT</span><span class="token punctuation">(</span><span class="token string">'foobarbar'</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'fooba'</span></code></pre>
     </div>
     <p>
      This function is multibyte safe.
     </p>
    </li>
    <li class="listitem">
     <a name="function_length">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_length">
       <code class="literal">
        LENGTH(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203295232">
     </a>
     <p>
      Returns the length of the string
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      , measured in bytes. A multibyte
          character counts as multiple bytes. This means that for a
          string containing five 2-byte characters,
      <a class="link" href="string-functions.html#function_length">
       <code class="literal">
        LENGTH()
       </code>
      </a>
      returns
      <code class="literal">
       10
      </code>
      , whereas
      <a class="link" href="string-functions.html#function_char-length">
       <code class="literal">
        CHAR_LENGTH()
       </code>
      </a>
      returns
      <code class="literal">
       5
      </code>
      . Returns
      <code class="literal">
       NULL
      </code>
      if
      <em class="replaceable">
       <code>
        str
       </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="sa50079136"><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">LENGTH</span><span class="token punctuation">(</span><span class="token string">'text'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token number">4</span></code></pre>
     </div>
     <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Note
      </div>
      <p>
       The
       <code class="literal">
        Length()
       </code>
       OpenGIS spatial function is
            named
       <a class="link" href="gis-linestring-property-functions.html#function_st-length">
        <code class="literal">
         ST_Length()
        </code>
       </a>
       in MySQL.
      </p>
     </div>
    </li>
    <li class="listitem">
     <a name="function_load-file">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_load-file">
       <code class="literal">
        LOAD_FILE(
        <em class="replaceable">
         <code>
          file_name
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203276064">
     </a>
     <a class="indexterm" name="idm46045203274992">
     </a>
     <p>
      Reads the file and returns the file contents as a string. To
          use this function, the file must be located on the server
          host, you must specify the full path name to the file, and you
          must have the
      <a class="link" href="privileges-provided.html#priv_file">
       <code class="literal">
        FILE
       </code>
      </a>
      privilege.
          The file must be readable by the server and its size less than
      <a class="link" href="server-system-variables.html#sysvar_max_allowed_packet">
       <code class="literal">
        max_allowed_packet
       </code>
      </a>
      bytes. If
          the
      <a class="link" href="server-system-variables.html#sysvar_secure_file_priv">
       <code class="literal">
        secure_file_priv
       </code>
      </a>
      system
          variable is set to a nonempty directory name, the file to be
          loaded must be located in that directory.
     </p>
     <p>
      If the file does not exist or cannot be read because one of
          the preceding conditions is not satisfied, the function
          returns
      <code class="literal">
       NULL
      </code>
      .
     </p>
     <p>
      The
      <a class="link" href="server-system-variables.html#sysvar_character_set_filesystem">
       <code class="literal">
        character_set_filesystem
       </code>
      </a>
      system variable controls interpretation of file names that are
          given as literal strings.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa83260174"><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> blob_col<span class="token operator">=</span><span class="token function">LOAD_FILE</span><span class="token punctuation">(</span><span class="token string">'/tmp/picture'</span><span class="token punctuation">)</span>
            <span class="token keyword">WHERE</span> id<span class="token operator">=</span><span class="token number">1</span><span class="token punctuation">;</span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_locate">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_locate">
       <code class="literal">
        LOCATE(
        <em class="replaceable">
         <code>
          substr
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
      ,
      <a class="link" href="string-functions.html#function_locate">
       <code class="literal">
        LOCATE(
        <em class="replaceable">
         <code>
          substr
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          pos
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203253472">
     </a>
     <p>
      The first syntax returns the position of the first occurrence
          of substring
      <em class="replaceable">
       <code>
        substr
       </code>
      </em>
      in string
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      . The second syntax returns the
          position of the first occurrence of substring
      <em class="replaceable">
       <code>
        substr
       </code>
      </em>
      in string
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      , starting at position
      <em class="replaceable">
       <code>
        pos
       </code>
      </em>
      . Returns
      <code class="literal">
       0
      </code>
      if
      <em class="replaceable">
       <code>
        substr
       </code>
      </em>
      is not in
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      . Returns
      <code class="literal">
       NULL
      </code>
      if any argument is
      <code class="literal">
       NULL
      </code>
      .
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa89130422"><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">LOCATE</span><span class="token punctuation">(</span><span class="token string">'bar'</span><span class="token punctuation">,</span> <span class="token string">'foobarbar'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token number">4</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">LOCATE</span><span class="token punctuation">(</span><span class="token string">'xbar'</span><span class="token punctuation">,</span> <span class="token string">'foobar'</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">LOCATE</span><span class="token punctuation">(</span><span class="token string">'bar'</span><span class="token punctuation">,</span> <span class="token string">'foobarbar'</span><span class="token punctuation">,</span> <span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token number">7</span></code></pre>
     </div>
     <p>
      This function is multibyte safe, and is case-sensitive only if
          at least one argument is a binary string.
     </p>
    </li>
    <li class="listitem">
     <a name="function_lower">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_lower">
       <code class="literal">
        LOWER(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203236064">
     </a>
     <p>
      Returns the string
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      with all
          characters changed to lowercase according to the current
          character set mapping, or
      <code class="literal">
       NULL
      </code>
      if
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      is
      <code class="literal">
       NULL
      </code>
      . The
          default character set is
      <code class="literal">
       utf8mb4
      </code>
      .
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa53318176"><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">LOWER</span><span class="token punctuation">(</span><span class="token string">'QUADRATICALLY'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'quadratically'</span></code></pre>
     </div>
     <p>
      <a class="link" href="string-functions.html#function_lower">
       <code class="literal">
        LOWER()
       </code>
      </a>
      (and
      <a class="link" href="string-functions.html#function_upper">
       <code class="literal">
        UPPER()
       </code>
      </a>
      ) are ineffective when
          applied to binary strings
          (
      <a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
       <code class="literal">
        BINARY
       </code>
      </a>
      ,
      <a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
       <code class="literal">
        VARBINARY
       </code>
      </a>
      ,
      <a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
       <code class="literal">
        BLOB
       </code>
      </a>
      ). To perform lettercase
          conversion of a binary string, first convert it to a nonbinary
          string using a character set appropriate for the data stored
          in the string:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa41130150"><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">@str</span> <span class="token operator">=</span> <span class="token datatype">BINARY</span> <span class="token string">'New York'</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">LOWER</span><span class="token punctuation">(</span><span class="token variable">@str</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">LOWER</span><span class="token punctuation">(</span><span class="token function">CONVERT</span><span class="token punctuation">(</span><span class="token variable">@str</span> <span class="token keyword">USING</span> utf8mb4<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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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> LOWER(@str) <span class="token punctuation">|</span> LOWER(CONVERT(@str USING utf8mb4)) <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>
<span class="token output"><span class="token punctuation">|</span> New York    <span class="token punctuation">|</span> new york                           <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></code></pre>
     </div>
     <p>
      For collations of Unicode character sets,
      <a class="link" href="string-functions.html#function_lower">
       <code class="literal">
        LOWER()
       </code>
      </a>
      and
      <a class="link" href="string-functions.html#function_upper">
       <code class="literal">
        UPPER()
       </code>
      </a>
      work according to the
          Unicode Collation Algorithm (UCA) version in the collation
          name, if there is one, and UCA 4.0.0 if no version is
          specified. For example,
      <code class="literal">
       utf8mb4_0900_ai_ci
      </code>
      and
      <code class="literal">
       utf8mb3_unicode_520_ci
      </code>
      work according
          to UCA 9.0.0 and 5.2.0, respectively, whereas
      <code class="literal">
       utf8mb3_unicode_ci
      </code>
      works according to UCA
          4.0.0. See
      <a class="xref" href="charset-unicode-sets.html" title="12.10.1 Unicode Character Sets">
       Section 12.10.1, “Unicode Character Sets”
      </a>
      .
     </p>
     <p>
      This function is multibyte safe.
     </p>
     <p>
      <code class="literal">
       LCASE()
      </code>
      used within views is rewritten as
      <code class="literal">
       LOWER()
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <a name="function_lpad">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_lpad">
       <code class="literal">
        LPAD(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          len
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          padstr
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203204720">
     </a>
     <p>
      Returns the string
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      , left-padded
          with the string
      <em class="replaceable">
       <code>
        padstr
       </code>
      </em>
      to a length
          of
      <em class="replaceable">
       <code>
        len
       </code>
      </em>
      characters. If
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      is longer than
      <em class="replaceable">
       <code>
        len
       </code>
      </em>
      , the return value is shortened
          to
      <em class="replaceable">
       <code>
        len
       </code>
      </em>
      characters.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa20696615"><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">LPAD</span><span class="token punctuation">(</span><span class="token string">'hi'</span><span class="token punctuation">,</span><span class="token number">4</span><span class="token punctuation">,</span><span class="token string">'??'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'??hi'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">LPAD</span><span class="token punctuation">(</span><span class="token string">'hi'</span><span class="token punctuation">,</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token string">'??'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'h'</span></code></pre>
     </div>
     <p>
      Returns
      <code class="literal">
       NULL
      </code>
      if any of its arguments are
      <code class="literal">
       NULL
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <a name="function_ltrim">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_ltrim">
       <code class="literal">
        LTRIM(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203189312">
     </a>
     <p>
      Returns the string
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      with leading
          space characters removed. Returns
      <code class="literal">
       NULL
      </code>
      if
      <em class="replaceable">
       <code>
        str
       </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="sa90604493"><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">LTRIM</span><span class="token punctuation">(</span><span class="token string">'  barbar'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'barbar'</span></code></pre>
     </div>
     <p>
      This function is multibyte safe.
     </p>
    </li>
    <li class="listitem">
     <a name="function_make-set">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_make-set">
       <code class="literal">
        MAKE_SET(
        <em class="replaceable">
         <code>
          bits
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          str1
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          str2
         </code>
        </em>
        ,...)
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203175552">
     </a>
     <p>
      Returns a set value (a string containing substrings separated
          by
      <code class="literal">
       ,
      </code>
      characters) consisting of the strings
          that have the corresponding bit in
      <em class="replaceable">
       <code>
        bits
       </code>
      </em>
      set.
      <em class="replaceable">
       <code>
        str1
       </code>
      </em>
      corresponds to bit 0,
      <em class="replaceable">
       <code>
        str2
       </code>
      </em>
      to bit 1, and so on.
      <code class="literal">
       NULL
      </code>
      values in
      <em class="replaceable">
       <code>
        str1
       </code>
      </em>
      ,
      <em class="replaceable">
       <code>
        str2
       </code>
      </em>
      ,
      <code class="literal">
       ...
      </code>
      are
          not appended to the result.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa96057680"><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">MAKE_SET</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token string">'a'</span><span class="token punctuation">,</span><span class="token string">'b'</span><span class="token punctuation">,</span><span class="token string">'c'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'a'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">MAKE_SET</span><span class="token punctuation">(</span><span class="token number">1</span> <span class="token operator">|</span> <span class="token number">4</span><span class="token punctuation">,</span><span class="token string">'hello'</span><span class="token punctuation">,</span><span class="token string">'nice'</span><span class="token punctuation">,</span><span class="token string">'world'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'hello,world'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">MAKE_SET</span><span class="token punctuation">(</span><span class="token number">1</span> <span class="token operator">|</span> <span class="token number">4</span><span class="token punctuation">,</span><span class="token string">'hello'</span><span class="token punctuation">,</span><span class="token string">'nice'</span><span class="token punctuation">,</span><span class="token boolean">NULL</span><span class="token punctuation">,</span><span class="token string">'world'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'hello'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">MAKE_SET</span><span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span><span class="token string">'a'</span><span class="token punctuation">,</span><span class="token string">'b'</span><span class="token punctuation">,</span><span class="token string">'c'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">''</span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_mid">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_mid">
       <code class="literal">
        MID(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          pos
         </code>
        </em>
        )
       </code>
      </a>
      ,
      <a class="link" href="string-functions.html#function_mid">
       <code class="literal">
        MID(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        FROM
        <em class="replaceable">
         <code>
          pos
         </code>
        </em>
        )
       </code>
      </a>
      ,
      <a class="link" href="string-functions.html#function_mid">
       <code class="literal">
        MID(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          pos
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          len
         </code>
        </em>
        )
       </code>
      </a>
      ,
      <a class="link" href="string-functions.html#function_mid">
       <code class="literal">
        MID(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        FROM
        <em class="replaceable">
         <code>
          pos
         </code>
        </em>
        FOR
        <em class="replaceable">
         <code>
          len
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203151392">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_mid">
       <code class="literal">
        MID(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          pos
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          len
         </code>
        </em>
        )
       </code>
      </a>
      is a synonym for
      <a class="link" href="string-functions.html#function_substring">
       <code class="literal">
        SUBSTRING(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          pos
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          len
         </code>
        </em>
        )
       </code>
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <a name="function_oct">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_oct">
       <code class="literal">
        OCT(
        <em class="replaceable">
         <code>
          N
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203138752">
     </a>
     <p>
      Returns a string representation of the octal value of
      <em class="replaceable">
       <code>
        N
       </code>
      </em>
      , where
      <em class="replaceable">
       <code>
        N
       </code>
      </em>
      is a longlong
          (
      <a class="link" href="integer-types.html" title="13.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT">
       <code class="literal">
        BIGINT
       </code>
      </a>
      ) number. This is
          equivalent to
      <a class="link" href="mathematical-functions.html#function_conv">
       <code class="literal">
        CONV(
        <em class="replaceable">
         <code>
          N
         </code>
        </em>
        ,10,8)
       </code>
      </a>
      .
          Returns
      <code class="literal">
       NULL
      </code>
      if
      <em class="replaceable">
       <code>
        N
       </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="sa43606228"><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">OCT</span><span class="token punctuation">(</span><span class="token number">12</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'14'</span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_octet-length">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_octet-length">
       <code class="literal">
        OCTET_LENGTH(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203123072">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_octet-length">
       <code class="literal">
        OCTET_LENGTH()
       </code>
      </a>
      is a synonym for
      <a class="link" href="string-functions.html#function_length">
       <code class="literal">
        LENGTH()
       </code>
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <a name="function_ord">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_ord">
       <code class="literal">
        ORD(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203112736">
     </a>
     <p>
      If the leftmost character of the string
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      is a multibyte character,
          returns the code for that character, calculated from the
          numeric values of its constituent bytes using this formula:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-clike"><div class="docs-select-all right" id="sa91020685"><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>1st byte code<span class="token punctuation">)</span>
<span class="token operator">+</span> <span class="token punctuation">(</span>2nd byte code <span class="token operator">*</span> <span class="token number">256</span><span class="token punctuation">)</span>
<span class="token operator">+</span> <span class="token punctuation">(</span>3rd byte code <span class="token operator">*</span> <span class="token number">256</span><span class="token operator">^</span><span class="token number">2</span><span class="token punctuation">)</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span></code></pre>
     </div>
     <p>
      If the leftmost character is not a multibyte character,
      <a class="link" href="string-functions.html#function_ord">
       <code class="literal">
        ORD()
       </code>
      </a>
      returns the same value as
          the
      <a class="link" href="string-functions.html#function_ascii">
       <code class="literal">
        ASCII()
       </code>
      </a>
      function. The
          function returns
      <code class="literal">
       NULL
      </code>
      if
      <em class="replaceable">
       <code>
        str
       </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="sa14073142"><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">ORD</span><span class="token punctuation">(</span><span class="token string">'2'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token number">50</span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_position">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_position">
       <code class="literal">
        POSITION(
        <em class="replaceable">
         <code>
          substr
         </code>
        </em>
        IN
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203095712">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_position">
       <code class="literal">
        POSITION(
        <em class="replaceable">
         <code>
          substr
         </code>
        </em>
        IN
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
      is a synonym for
      <a class="link" href="string-functions.html#function_locate">
       <code class="literal">
        LOCATE(
        <em class="replaceable">
         <code>
          substr
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <a name="function_quote">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_quote">
       <code class="literal">
        QUOTE(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203083744">
     </a>
     <p>
      Quotes a string to produce a result that can be used as a
          properly escaped data value in an SQL statement. The string is
          returned enclosed by single quotation marks and with each
          instance of backslash (
      <code class="literal">
       \
      </code>
      ), single quote
          (
      <code class="literal">
       '
      </code>
      ), ASCII
      <code class="literal">
       NUL
      </code>
      , and
          Control+Z preceded by a backslash. If the argument is
      <code class="literal">
       NULL
      </code>
      , the return value is the word
      <span class="quote">
       “
       <span class="quote">
        NULL
       </span>
       ”
      </span>
      without enclosing single quotation marks.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa39237508"><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">QUOTE</span><span class="token punctuation">(</span><span class="token string">'Don\'t!'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'Don\'t!'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">QUOTE</span><span class="token punctuation">(</span><span class="token boolean">NULL</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token boolean">NULL</span></code></pre>
     </div>
     <a class="indexterm" name="idm46045203074096">
     </a>
     <p>
      For comparison, see the quoting rules for literal strings and
          within the C API in
      <a class="xref" href="string-literals.html" title="11.1.1 String Literals">
       Section 11.1.1, “String Literals”
      </a>
      , and
      <a class="ulink" href="/doc/c-api/8.4/en/mysql-real-escape-string-quote.html" target="_top">
       mysql_real_escape_string_quote()
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <a name="function_repeat">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_repeat">
       <code class="literal">
        REPEAT(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          count
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203065808">
     </a>
     <p>
      Returns a string consisting of the string
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      repeated
      <em class="replaceable">
       <code>
        count
       </code>
      </em>
      times. If
      <em class="replaceable">
       <code>
        count
       </code>
      </em>
      is less than 1, returns an
          empty string. Returns
      <code class="literal">
       NULL
      </code>
      if
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      or
      <em class="replaceable">
       <code>
        count
       </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="sa97835741"><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">REPEAT</span><span class="token punctuation">(</span><span class="token string">'MySQL'</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 prompt">        -&gt;</span> <span class="token string">'MySQLMySQLMySQL'</span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_replace">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_replace">
       <code class="literal">
        REPLACE(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          from_str
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          to_str
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203051184">
     </a>
     <p>
      Returns the string
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      with all
          occurrences of the string
      <em class="replaceable">
       <code>
        from_str
       </code>
      </em>
      replaced by the string
      <em class="replaceable">
       <code>
        to_str
       </code>
      </em>
      .
      <a class="link" href="string-functions.html#function_replace">
       <code class="literal">
        REPLACE()
       </code>
      </a>
      performs a
          case-sensitive match when searching for
      <em class="replaceable">
       <code>
        from_str
       </code>
      </em>
      .
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa88461084"><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">REPLACE</span><span class="token punctuation">(</span><span class="token string">'www.mysql.com'</span><span class="token punctuation">,</span> <span class="token string">'w'</span><span class="token punctuation">,</span> <span class="token string">'Ww'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'WwWwWw.mysql.com'</span></code></pre>
     </div>
     <p>
      This function is multibyte safe. It returns
      <code class="literal">
       NULL
      </code>
      if any of its arguments are
      <code class="literal">
       NULL
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <a name="function_reverse">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_reverse">
       <code class="literal">
        REVERSE(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203036048">
     </a>
     <p>
      Returns the string
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      with the
          order of the characters reversed, or
      <code class="literal">
       NULL
      </code>
      if
      <em class="replaceable">
       <code>
        str
       </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="sa70488247"><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">REVERSE</span><span class="token punctuation">(</span><span class="token string">'abc'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'cba'</span></code></pre>
     </div>
     <p>
      This function is multibyte safe.
     </p>
    </li>
    <li class="listitem">
     <a name="function_right">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_right">
       <code class="literal">
        RIGHT(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          len
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203022816">
     </a>
     <p>
      Returns the rightmost
      <em class="replaceable">
       <code>
        len
       </code>
      </em>
      characters from the string
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      , or
      <code class="literal">
       NULL
      </code>
      if any argument is
      <code class="literal">
       NULL
      </code>
      .
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa55212818"><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">RIGHT</span><span class="token punctuation">(</span><span class="token string">'foobarbar'</span><span class="token punctuation">,</span> <span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'rbar'</span></code></pre>
     </div>
     <p>
      This function is multibyte safe.
     </p>
    </li>
    <li class="listitem">
     <a name="function_rpad">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_rpad">
       <code class="literal">
        RPAD(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          len
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          padstr
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045203009232">
     </a>
     <p>
      Returns the string
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      ,
          right-padded with the string
      <em class="replaceable">
       <code>
        padstr
       </code>
      </em>
      to a length of
      <em class="replaceable">
       <code>
        len
       </code>
      </em>
      characters. If
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      is longer than
      <em class="replaceable">
       <code>
        len
       </code>
      </em>
      , the return value is shortened
          to
      <em class="replaceable">
       <code>
        len
       </code>
      </em>
      characters. If
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      ,
      <em class="replaceable">
       <code>
        padstr
       </code>
      </em>
      , or
      <em class="replaceable">
       <code>
        len
       </code>
      </em>
      is
      <code class="literal">
       NULL
      </code>
      , the
          function returns
      <code class="literal">
       NULL
      </code>
      .
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69862993"><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">RPAD</span><span class="token punctuation">(</span><span class="token string">'hi'</span><span class="token punctuation">,</span><span class="token number">5</span><span class="token punctuation">,</span><span class="token string">'?'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'hi???'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">RPAD</span><span class="token punctuation">(</span><span class="token string">'hi'</span><span class="token punctuation">,</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token string">'?'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'h'</span></code></pre>
     </div>
     <p>
      This function is multibyte safe.
     </p>
    </li>
    <li class="listitem">
     <a name="function_rtrim">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_rtrim">
       <code class="literal">
        RTRIM(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045202992496">
     </a>
     <p>
      Returns the string
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      with
          trailing space characters removed.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa61458262"><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">RTRIM</span><span class="token punctuation">(</span><span class="token string">'barbar   '</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'barbar'</span></code></pre>
     </div>
     <p>
      This function is multibyte safe, and returns
      <code class="literal">
       NULL
      </code>
      if
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      is
      <code class="literal">
       NULL
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <a name="function_soundex">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_soundex">
       <code class="literal">
        SOUNDEX(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045202979616">
     </a>
     <p>
      Returns a soundex string from
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      ,
          or
      <code class="literal">
       NULL
      </code>
      if
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      is
      <code class="literal">
       NULL
      </code>
      . Two strings that sound almost the
          same should have identical soundex strings. A standard soundex
          string is four characters long, but the
      <a class="link" href="string-functions.html#function_soundex">
       <code class="literal">
        SOUNDEX()
       </code>
      </a>
      function returns an
          arbitrarily long string. You can use
      <a class="link" href="string-functions.html#function_substring">
       <code class="literal">
        SUBSTRING()
       </code>
      </a>
      on the result to
          get a standard soundex string. All nonalphabetic characters in
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      are ignored. All international
          alphabetic characters outside the A-Z range are treated as
          vowels.
     </p>
     <div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Important
      </div>
      <p>
       When using
       <a class="link" href="string-functions.html#function_soundex">
        <code class="literal">
         SOUNDEX()
        </code>
       </a>
       , you
            should be aware of the following limitations:
      </p>
     </div>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         This function, as currently implemented, is intended to
              work well with strings that are in the English language
              only. Strings in other languages may not produce reliable
              results.
        </p>
       </li>
       <li class="listitem">
        <p>
         This function is not guaranteed to provide consistent
              results with strings that use multibyte character sets,
              including
         <code class="literal">
          utf-8
         </code>
         . See Bug #22638 for
              more information.
        </p>
       </li>
      </ul>
     </div>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa63223011"><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">SOUNDEX</span><span class="token punctuation">(</span><span class="token string">'Hello'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'H400'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">SOUNDEX</span><span class="token punctuation">(</span><span class="token string">'Quadratically'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'Q36324'</span></code></pre>
     </div>
     <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Note
      </div>
      <p>
       This function implements the original Soundex algorithm, not
            the more popular enhanced version (also described by D.
            Knuth). The difference is that original version discards
            vowels first and duplicates second, whereas the enhanced
            version discards duplicates first and vowels second.
      </p>
     </div>
    </li>
    <li class="listitem">
     <a name="operator_sounds-like">
     </a>
     <p>
      <a class="link" href="string-functions.html#operator_sounds-like">
       <code class="literal">
        <em class="replaceable">
         <code>
          expr1
         </code>
        </em>
        SOUNDS LIKE
        <em class="replaceable">
         <code>
          expr2
         </code>
        </em>
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045202956560">
     </a>
     <p>
      This is the same as
      <a class="link" href="string-functions.html#function_soundex">
       <code class="literal">
        SOUNDEX(
        <em class="replaceable">
         <code>
          expr1
         </code>
        </em>
        )
          = SOUNDEX(
        <em class="replaceable">
         <code>
          expr2
         </code>
        </em>
        )
       </code>
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <a name="function_space">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_space">
       <code class="literal">
        SPACE(
        <em class="replaceable">
         <code>
          N
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045202946544">
     </a>
     <p>
      Returns a string consisting of
      <em class="replaceable">
       <code>
        N
       </code>
      </em>
      space characters, or
      <code class="literal">
       NULL
      </code>
      if
      <em class="replaceable">
       <code>
        N
       </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="sa76532257"><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">SPACE</span><span class="token punctuation">(</span><span class="token number">6</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'      '</span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <a name="function_substr">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_substr">
       <code class="literal">
        SUBSTR(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          pos
         </code>
        </em>
        )
       </code>
      </a>
      ,
      <a class="link" href="string-functions.html#function_substr">
       <code class="literal">
        SUBSTR(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        FROM
        <em class="replaceable">
         <code>
          pos
         </code>
        </em>
        )
       </code>
      </a>
      ,
      <a class="link" href="string-functions.html#function_substr">
       <code class="literal">
        SUBSTR(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          pos
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          len
         </code>
        </em>
        )
       </code>
      </a>
      ,
      <a class="link" href="string-functions.html#function_substr">
       <code class="literal">
        SUBSTR(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        FROM
        <em class="replaceable">
         <code>
          pos
         </code>
        </em>
        FOR
        <em class="replaceable">
         <code>
          len
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045202926912">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_substr">
       <code class="literal">
        SUBSTR()
       </code>
      </a>
      is a synonym for
      <a class="link" href="string-functions.html#function_substring">
       <code class="literal">
        SUBSTRING()
       </code>
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <a name="function_substring">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_substring">
       <code class="literal">
        SUBSTRING(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          pos
         </code>
        </em>
        )
       </code>
      </a>
      ,
      <a class="link" href="string-functions.html#function_substring">
       <code class="literal">
        SUBSTRING(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        FROM
        <em class="replaceable">
         <code>
          pos
         </code>
        </em>
        )
       </code>
      </a>
      ,
      <a class="link" href="string-functions.html#function_substring">
       <code class="literal">
        SUBSTRING(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          pos
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          len
         </code>
        </em>
        )
       </code>
      </a>
      ,
      <a class="link" href="string-functions.html#function_substring">
       <code class="literal">
        SUBSTRING(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        FROM
        <em class="replaceable">
         <code>
          pos
         </code>
        </em>
        FOR
        <em class="replaceable">
         <code>
          len
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045202909328">
     </a>
     <p>
      The forms without a
      <em class="replaceable">
       <code>
        len
       </code>
      </em>
      argument
          return a substring from string
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      starting at position
      <em class="replaceable">
       <code>
        pos
       </code>
      </em>
      . The forms
          with a
      <em class="replaceable">
       <code>
        len
       </code>
      </em>
      argument return a
          substring
      <em class="replaceable">
       <code>
        len
       </code>
      </em>
      characters long from
          string
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      , starting at position
      <em class="replaceable">
       <code>
        pos
       </code>
      </em>
      . The forms that use
      <code class="literal">
       FROM
      </code>
      are standard SQL syntax. It is also
          possible to use a negative value for
      <em class="replaceable">
       <code>
        pos
       </code>
      </em>
      . In this case, the beginning of
          the substring is
      <em class="replaceable">
       <code>
        pos
       </code>
      </em>
      characters
          from the end of the string, rather than the beginning. A
          negative value may be used for
      <em class="replaceable">
       <code>
        pos
       </code>
      </em>
      in any of the forms of this function. A value of 0 for
      <em class="replaceable">
       <code>
        pos
       </code>
      </em>
      returns an empty string.
     </p>
     <p>
      For all forms of
      <a class="link" href="string-functions.html#function_substring">
       <code class="literal">
        SUBSTRING()
       </code>
      </a>
      ,
          the position of the first character in the string from which
          the substring is to be extracted is reckoned as
      <code class="literal">
       1
      </code>
      .
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa89214630"><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">SUBSTRING</span><span class="token punctuation">(</span><span class="token string">'Quadratically'</span><span class="token punctuation">,</span><span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'ratically'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">SUBSTRING</span><span class="token punctuation">(</span><span class="token string">'foobarbar'</span> <span class="token keyword">FROM</span> <span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'barbar'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">SUBSTRING</span><span class="token punctuation">(</span><span class="token string">'Quadratically'</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 punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'ratica'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">SUBSTRING</span><span class="token punctuation">(</span><span class="token string">'Sakila'</span><span class="token punctuation">,</span> <span class="token operator">-</span><span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'ila'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">SUBSTRING</span><span class="token punctuation">(</span><span class="token string">'Sakila'</span><span class="token punctuation">,</span> <span class="token operator">-</span><span class="token number">5</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 prompt">        -&gt;</span> <span class="token string">'aki'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">SUBSTRING</span><span class="token punctuation">(</span><span class="token string">'Sakila'</span> <span class="token keyword">FROM</span> <span class="token operator">-</span><span class="token number">4</span> <span class="token keyword">FOR</span> <span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'ki'</span></code></pre>
     </div>
     <p>
      This function is multibyte safe. It returns
      <code class="literal">
       NULL
      </code>
      if any of its arguments are
      <code class="literal">
       NULL
      </code>
      .
     </p>
     <p>
      If
      <em class="replaceable">
       <code>
        len
       </code>
      </em>
      is less than 1, the result
          is the empty string.
     </p>
    </li>
    <li class="listitem">
     <a name="function_substring-index">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_substring-index">
       <code class="literal">
        SUBSTRING_INDEX(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          delim
         </code>
        </em>
        ,
        <em class="replaceable">
         <code>
          count
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045202883312">
     </a>
     <p>
      Returns the substring from string
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      before
      <em class="replaceable">
       <code>
        count
       </code>
      </em>
      occurrences of the delimiter
      <em class="replaceable">
       <code>
        delim
       </code>
      </em>
      . If
      <em class="replaceable">
       <code>
        count
       </code>
      </em>
      is positive, everything to
          the left of the final delimiter (counting from the left) is
          returned. If
      <em class="replaceable">
       <code>
        count
       </code>
      </em>
      is negative,
          everything to the right of the final delimiter (counting from
          the right) is returned.
      <a class="link" href="string-functions.html#function_substring-index">
       <code class="literal">
        SUBSTRING_INDEX()
       </code>
      </a>
      performs a
          case-sensitive match when searching for
      <em class="replaceable">
       <code>
        delim
       </code>
      </em>
      .
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa50761303"><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">SUBSTRING_INDEX</span><span class="token punctuation">(</span><span class="token string">'www.mysql.com'</span><span class="token punctuation">,</span> <span class="token string">'.'</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'www.mysql'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">SUBSTRING_INDEX</span><span class="token punctuation">(</span><span class="token string">'www.mysql.com'</span><span class="token punctuation">,</span> <span class="token string">'.'</span><span class="token punctuation">,</span> <span class="token operator">-</span><span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'mysql.com'</span></code></pre>
     </div>
     <p>
      This function is multibyte safe.
     </p>
     <p>
      <code class="literal">
       SUBSTRING_INDEX()
      </code>
      returns
      <code class="literal">
       NULL
      </code>
      if any of its arguments are
      <code class="literal">
       NULL
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <a name="function_to-base64">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_to-base64">
       <code class="literal">
        TO_BASE64(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045202865168">
     </a>
     <p>
      Converts the string argument to base-64 encoded form and
          returns the result as a character string with the connection
          character set and collation. If the argument is not a string,
          it is converted to a string before conversion takes place. The
          result is
      <code class="literal">
       NULL
      </code>
      if the argument is
      <code class="literal">
       NULL
      </code>
      . Base-64 encoded strings can be
          decoded using the
      <a class="link" href="string-functions.html#function_from-base64">
       <code class="literal">
        FROM_BASE64()
       </code>
      </a>
      function.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa70610820"><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">TO_BASE64</span><span class="token punctuation">(</span><span class="token string">'abc'</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">FROM_BASE64</span><span class="token punctuation">(</span><span class="token function">TO_BASE64</span><span class="token punctuation">(</span><span class="token string">'abc'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'JWJj'</span><span class="token punctuation">,</span> <span class="token string">'abc'</span></code></pre>
     </div>
     <p>
      Different base-64 encoding schemes exist. These are the
          encoding and decoding rules used by
      <a class="link" href="string-functions.html#function_to-base64">
       <code class="literal">
        TO_BASE64()
       </code>
      </a>
      and
      <a class="link" href="string-functions.html#function_from-base64">
       <code class="literal">
        FROM_BASE64()
       </code>
      </a>
      :
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         The encoding for alphabet value 62 is
         <code class="literal">
          '+'
         </code>
         .
        </p>
       </li>
       <li class="listitem">
        <p>
         The encoding for alphabet value 63 is
         <code class="literal">
          '/'
         </code>
         .
        </p>
       </li>
       <li class="listitem">
        <p>
         Encoded output consists of groups of 4 printable
              characters. Each 3 bytes of the input data are encoded
              using 4 characters. If the last group is incomplete, it is
              padded with
         <code class="literal">
          '='
         </code>
         characters to a length
              of 4.
        </p>
       </li>
       <li class="listitem">
        <p>
         A newline is added after each 76 characters of encoded
              output to divide long output into multiple lines.
        </p>
       </li>
       <li class="listitem">
        <p>
         Decoding recognizes and ignores newline, carriage return,
              tab, and space.
        </p>
       </li>
      </ul>
     </div>
    </li>
    <li class="listitem">
     <a name="function_trim">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_trim">
       <code class="literal">
        TRIM([{BOTH | LEADING | TRAILING}
          [
        <em class="replaceable">
         <code>
          remstr
         </code>
        </em>
        ] FROM]
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
      ,
      <a class="link" href="string-functions.html#function_trim">
       <code class="literal">
        TRIM([
        <em class="replaceable">
         <code>
          remstr
         </code>
        </em>
        FROM]
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045202839296">
     </a>
     <p>
      Returns the string
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      with all
      <em class="replaceable">
       <code>
        remstr
       </code>
      </em>
      prefixes or suffixes
          removed. If none of the specifiers
      <code class="literal">
       BOTH
      </code>
      ,
      <code class="literal">
       LEADING
      </code>
      , or
      <code class="literal">
       TRAILING
      </code>
      is
          given,
      <code class="literal">
       BOTH
      </code>
      is assumed.
      <em class="replaceable">
       <code>
        remstr
       </code>
      </em>
      is optional and, if not
          specified, spaces are removed.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa86455714"><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">TRIM</span><span class="token punctuation">(</span><span class="token string">'  bar   '</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'bar'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">TRIM</span><span class="token punctuation">(</span><span class="token keyword">LEADING</span> <span class="token string">'x'</span> <span class="token keyword">FROM</span> <span class="token string">'xxxbarxxx'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'barxxx'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">TRIM</span><span class="token punctuation">(</span><span class="token keyword">BOTH</span> <span class="token string">'x'</span> <span class="token keyword">FROM</span> <span class="token string">'xxxbarxxx'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'bar'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">TRIM</span><span class="token punctuation">(</span><span class="token keyword">TRAILING</span> <span class="token string">'xyz'</span> <span class="token keyword">FROM</span> <span class="token string">'barxxyz'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'barx'</span></code></pre>
     </div>
     <p>
      This function is multibyte safe. It returns
      <code class="literal">
       NULL
      </code>
      if any of its arguments are
      <code class="literal">
       NULL
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <a name="function_ucase">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_ucase">
       <code class="literal">
        UCASE(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045202820608">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_ucase">
       <code class="literal">
        UCASE()
       </code>
      </a>
      is a synonym for
      <a class="link" href="string-functions.html#function_upper">
       <code class="literal">
        UPPER()
       </code>
      </a>
      .
     </p>
     <p>
      <code class="literal">
       UCASE()
      </code>
      used within views is rewritten as
      <code class="literal">
       UPPER()
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <a name="function_unhex">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_unhex">
       <code class="literal">
        UNHEX(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045202808416">
     </a>
     <p>
      For a string argument
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      ,
      <a class="link" href="string-functions.html#function_unhex">
       <code class="literal">
        UNHEX(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
      interprets each pair of characters in the argument as a
          hexadecimal number and converts it to the byte represented by
          the number. The return value is a binary string.
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa8810038"><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">UNHEX</span><span class="token punctuation">(</span><span class="token string">'4D7953514C'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'MySQL'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> X<span class="token string">'4D7953514C'</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'MySQL'</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">UNHEX</span><span class="token punctuation">(</span><span class="token function">HEX</span><span class="token punctuation">(</span><span class="token string">'string'</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">'string'</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">UNHEX</span><span class="token punctuation">(</span><span class="token string">'1267'</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">'1267'</span></code></pre>
     </div>
     <p>
      The characters in the argument string must be legal
          hexadecimal digits:
      <code class="literal">
       '0'
      </code>
      ..
      <code class="literal">
       '9'
      </code>
      ,
      <code class="literal">
       'A'
      </code>
      ..
      <code class="literal">
       'F'
      </code>
      ,
      <code class="literal">
       'a'
      </code>
      ..
      <code class="literal">
       'f'
      </code>
      . If the argument contains any
          nonhexadecimal digits, or is itself
      <code class="literal">
       NULL
      </code>
      ,
          the result is
      <code class="literal">
       NULL
      </code>
      :
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa21034611"><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">UNHEX</span><span class="token punctuation">(</span><span class="token string">'GG'</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> UNHEX('GG') <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> NULL        <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 prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token function">UNHEX</span><span class="token punctuation">(</span><span class="token boolean">NULL</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> UNHEX(NULL) <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> NULL        <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>
      A
      <code class="literal">
       NULL
      </code>
      result can also occur if the
          argument to
      <a class="link" href="string-functions.html#function_unhex">
       <code class="literal">
        UNHEX()
       </code>
      </a>
      is a
      <a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
       <code class="literal">
        BINARY
       </code>
      </a>
      column, because values
          are padded with
      <code class="literal">
       0x00
      </code>
      bytes when stored but
          those bytes are not stripped on retrieval. For example,
      <code class="literal">
       '41'
      </code>
      is stored into a
      <code class="literal">
       CHAR(3)
      </code>
      column as
      <code class="literal">
       '41 '
      </code>
      and retrieved as
      <code class="literal">
       '41'
      </code>
      (with the trailing pad space
          stripped), so
      <a class="link" href="string-functions.html#function_unhex">
       <code class="literal">
        UNHEX()
       </code>
      </a>
      for the
          column value returns
      <code class="literal">
       X'41'
      </code>
      . By contrast,
      <code class="literal">
       '41'
      </code>
      is stored into a
      <code class="literal">
       BINARY(3)
      </code>
      column as
      <code class="literal">
       '41\0'
      </code>
      and retrieved as
      <code class="literal">
       '41\0'
      </code>
      (with the trailing pad
      <code class="literal">
       0x00
      </code>
      byte not stripped).
      <code class="literal">
       '\0'
      </code>
      is not a legal hexadecimal digit, so
      <a class="link" href="string-functions.html#function_unhex">
       <code class="literal">
        UNHEX()
       </code>
      </a>
      for the column value
          returns
      <code class="literal">
       NULL
      </code>
      .
     </p>
     <p>
      For a numeric argument
      <em class="replaceable">
       <code>
        N
       </code>
      </em>
      , the
          inverse of
      <a class="link" href="string-functions.html#function_hex">
       <code class="literal">
        HEX(
        <em class="replaceable">
         <code>
          N
         </code>
        </em>
        )
       </code>
      </a>
      is not performed by
      <a class="link" href="string-functions.html#function_unhex">
       <code class="literal">
        UNHEX()
       </code>
      </a>
      .
          Use
      <a class="link" href="mathematical-functions.html#function_conv">
       <code class="literal">
        CONV(HEX(
        <em class="replaceable">
         <code>
          N
         </code>
        </em>
        ),16,10)
       </code>
      </a>
      instead. See the description of
      <a class="link" href="string-functions.html#function_hex">
       <code class="literal">
        HEX()
       </code>
      </a>
      .
     </p>
     <p>
      If
      <a class="link" href="string-functions.html#function_unhex">
       <code class="literal">
        UNHEX()
       </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_upper">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_upper">
       <code class="literal">
        UPPER(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        )
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045202757776">
     </a>
     <p>
      Returns the string
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      with all
          characters changed to uppercase according to the current
          character set mapping, or
      <code class="literal">
       NULL
      </code>
      if
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      is
      <code class="literal">
       NULL
      </code>
      . The
          default character set is
      <code class="literal">
       utf8mb4
      </code>
      .
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa66791064"><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">UPPER</span><span class="token punctuation">(</span><span class="token string">'Hej'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">        -&gt;</span> <span class="token string">'HEJ'</span></code></pre>
     </div>
     <p>
      See the description of
      <a class="link" href="string-functions.html#function_lower">
       <code class="literal">
        LOWER()
       </code>
      </a>
      for information that also applies to
      <a class="link" href="string-functions.html#function_upper">
       <code class="literal">
        UPPER()
       </code>
      </a>
      . This included
          information about how to perform lettercase conversion of
          binary strings (
      <a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
       <code class="literal">
        BINARY
       </code>
      </a>
      ,
      <a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
       <code class="literal">
        VARBINARY
       </code>
      </a>
      ,
      <a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
       <code class="literal">
        BLOB
       </code>
      </a>
      ) for which these functions
          are ineffective, and information about case folding for
          Unicode character sets.
     </p>
     <p>
      This function is multibyte safe.
     </p>
     <p>
      <code class="literal">
       UCASE()
      </code>
      used within views is rewritten as
      <code class="literal">
       UPPER()
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <a name="function_weight-string">
     </a>
     <p>
      <a class="link" href="string-functions.html#function_weight-string">
       <code class="literal">
        WEIGHT_STRING(
        <em class="replaceable">
         <code>
          str
         </code>
        </em>
        [AS {CHAR|BINARY}(
        <em class="replaceable">
         <code>
          N
         </code>
        </em>
        )]
          [
        <em class="replaceable">
         <code>
          flags
         </code>
        </em>
        ])
       </code>
      </a>
     </p>
     <a class="indexterm" name="idm46045202735056">
     </a>
     <p>
      This function returns the weight string for the input string.
          The return value is a binary string that represents the
          comparison and sorting value of the string, or
      <code class="literal">
       NULL
      </code>
      if the argument is
      <code class="literal">
       NULL
      </code>
      . It has these properties:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         If
         <a class="link" href="string-functions.html#function_weight-string">
          <code class="literal">
           WEIGHT_STRING(
           <em class="replaceable">
            <code>
             str1
            </code>
           </em>
           )
          </code>
         </a>
         =
         <a class="link" href="string-functions.html#function_weight-string">
          <code class="literal">
           WEIGHT_STRING(
           <em class="replaceable">
            <code>
             str2
            </code>
           </em>
           )
          </code>
         </a>
         ,
              then
         <code class="literal">
          <em class="replaceable">
           <code>
            str1
           </code>
          </em>
          =
          <em class="replaceable">
           <code>
            str2
           </code>
          </em>
         </code>
         (
         <em class="replaceable">
          <code>
           str1
          </code>
         </em>
         and
         <em class="replaceable">
          <code>
           str2
          </code>
         </em>
         are considered equal)
        </p>
       </li>
       <li class="listitem">
        <p>
         If
         <a class="link" href="string-functions.html#function_weight-string">
          <code class="literal">
           WEIGHT_STRING(
           <em class="replaceable">
            <code>
             str1
            </code>
           </em>
           )
          </code>
         </a>
         &lt;
         <a class="link" href="string-functions.html#function_weight-string">
          <code class="literal">
           WEIGHT_STRING(
           <em class="replaceable">
            <code>
             str2
            </code>
           </em>
           )
          </code>
         </a>
         ,
              then
         <code class="literal">
          <em class="replaceable">
           <code>
            str1
           </code>
          </em>
          &lt;
          <em class="replaceable">
           <code>
            str2
           </code>
          </em>
         </code>
         (
         <em class="replaceable">
          <code>
           str1
          </code>
         </em>
         sorts before
         <em class="replaceable">
          <code>
           str2
          </code>
         </em>
         )
        </p>
       </li>
      </ul>
     </div>
     <p>
      <a class="link" href="string-functions.html#function_weight-string">
       <code class="literal">
        WEIGHT_STRING()
       </code>
      </a>
      is a debugging
          function intended for internal use. Its behavior can change
          without notice between MySQL versions. It can be used for
          testing and debugging of collations, especially if you are
          adding a new collation. See
      <a class="xref" href="adding-collation.html" title="12.14 Adding a Collation to a Character Set">
       Section 12.14, “Adding a Collation to a Character Set”
      </a>
      .
     </p>
     <p>
      This list briefly summarizes the arguments. More details are
          given in the discussion following the list.
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         <em class="replaceable">
          <code>
           str
          </code>
         </em>
         : The input string
              expression.
        </p>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          AS
         </code>
         clause: Optional; cast the input
              string to a given type and length.
        </p>
       </li>
       <li class="listitem">
        <p>
         <em class="replaceable">
          <code>
           flags
          </code>
         </em>
         : Optional; unused.
        </p>
       </li>
      </ul>
     </div>
     <p>
      The input string,
      <em class="replaceable">
       <code>
        str
       </code>
      </em>
      , is a string
          expression. If the input is a nonbinary (character) string
          such as a
      <a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
       <code class="literal">
        CHAR
       </code>
      </a>
      ,
      <a class="link" href="char.html" title="13.3.2 The CHAR and VARCHAR Types">
       <code class="literal">
        VARCHAR
       </code>
      </a>
      , or
      <a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
       <code class="literal">
        TEXT
       </code>
      </a>
      value, the return value
          contains the collation weights for the string. If the input is
          a binary (byte) string such as a
      <a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
       <code class="literal">
        BINARY
       </code>
      </a>
      ,
      <a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
       <code class="literal">
        VARBINARY
       </code>
      </a>
      , or
      <a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
       <code class="literal">
        BLOB
       </code>
      </a>
      value, the return value is
          the same as the input (the weight for each byte in a binary
          string is the byte value). If the input is
      <code class="literal">
       NULL
      </code>
      ,
      <a class="link" href="string-functions.html#function_weight-string">
       <code class="literal">
        WEIGHT_STRING()
       </code>
      </a>
      returns
      <code class="literal">
       NULL
      </code>
      .
     </p>
     <p>
      Examples:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa54113437"><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">@s</span> <span class="token operator">=</span> _utf8mb4 <span class="token string">'AB'</span> <span class="token keyword">COLLATE</span> utf8mb4_0900_ai_ci<span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token variable">@s</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token variable">@s</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">WEIGHT_STRING</span><span class="token punctuation">(</span><span class="token variable">@s</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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> @s   <span class="token punctuation">|</span> HEX(@s) <span class="token punctuation">|</span> HEX(WEIGHT_STRING(@s)) <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>
<span class="token output"><span class="token punctuation">|</span> AB   <span class="token punctuation">|</span> 4142    <span class="token punctuation">|</span> 1C471C60               <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></code></pre>
     </div>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa73594578"><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">@s</span> <span class="token operator">=</span> _utf8mb4 <span class="token string">'ab'</span> <span class="token keyword">COLLATE</span> utf8mb4_0900_ai_ci<span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token variable">@s</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token variable">@s</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">WEIGHT_STRING</span><span class="token punctuation">(</span><span class="token variable">@s</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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> @s   <span class="token punctuation">|</span> HEX(@s) <span class="token punctuation">|</span> HEX(WEIGHT_STRING(@s)) <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>
<span class="token output"><span class="token punctuation">|</span> ab   <span class="token punctuation">|</span> 6162    <span class="token punctuation">|</span> 1C471C60               <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></code></pre>
     </div>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa17311837"><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">@s</span> <span class="token operator">=</span> <span class="token function">CAST</span><span class="token punctuation">(</span><span class="token string">'AB'</span> <span class="token keyword">AS</span> <span class="token datatype">BINARY</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token variable">@s</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token variable">@s</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">WEIGHT_STRING</span><span class="token punctuation">(</span><span class="token variable">@s</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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> @s   <span class="token punctuation">|</span> HEX(@s) <span class="token punctuation">|</span> HEX(WEIGHT_STRING(@s)) <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>
<span class="token output"><span class="token punctuation">|</span> AB   <span class="token punctuation">|</span> 4142    <span class="token punctuation">|</span> 4142                   <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></code></pre>
     </div>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa35660432"><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">@s</span> <span class="token operator">=</span> <span class="token function">CAST</span><span class="token punctuation">(</span><span class="token string">'ab'</span> <span class="token keyword">AS</span> <span class="token datatype">BINARY</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token variable">@s</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token variable">@s</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token function">HEX</span><span class="token punctuation">(</span><span class="token function">WEIGHT_STRING</span><span class="token punctuation">(</span><span class="token variable">@s</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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> @s   <span class="token punctuation">|</span> HEX(@s) <span class="token punctuation">|</span> HEX(WEIGHT_STRING(@s)) <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>
<span class="token output"><span class="token punctuation">|</span> ab   <span class="token punctuation">|</span> 6162    <span class="token punctuation">|</span> 6162                   <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></code></pre>
     </div>
     <p>
      The preceding examples use
      <a class="link" href="string-functions.html#function_hex">
       <code class="literal">
        HEX()
       </code>
      </a>
      to display the
      <a class="link" href="string-functions.html#function_weight-string">
       <code class="literal">
        WEIGHT_STRING()
       </code>
      </a>
      result. Because
          the result is a binary value,
      <a class="link" href="string-functions.html#function_hex">
       <code class="literal">
        HEX()
       </code>
      </a>
      can be especially useful
          when the result contains nonprinting values, to display it in
          printable form:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa68981741"><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">@s</span> <span class="token operator">=</span> <span class="token function">CONVERT</span><span class="token punctuation">(</span>X<span class="token string">'C39F'</span> <span class="token keyword">USING</span> utf8mb4<span class="token punctuation">)</span> <span class="token keyword">COLLATE</span> utf8mb4_czech_ci<span class="token punctuation">;</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">WEIGHT_STRING</span><span class="token punctuation">(</span><span class="token variable">@s</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>
<span class="token output"><span class="token punctuation">|</span> HEX(WEIGHT_STRING(@s)) <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> 0FEA0FEA               <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>
      For non-
      <code class="literal">
       NULL
      </code>
      return values, the data type
          of the value is
      <a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
       <code class="literal">
        VARBINARY
       </code>
      </a>
      if
          its length is within the maximum length for
      <a class="link" href="binary-varbinary.html" title="13.3.3 The BINARY and VARBINARY Types">
       <code class="literal">
        VARBINARY
       </code>
      </a>
      , otherwise the data
          type is
      <a class="link" href="blob.html" title="13.3.4 The BLOB and TEXT Types">
       <code class="literal">
        BLOB
       </code>
      </a>
      .
     </p>
     <p>
      The
      <code class="literal">
       AS
      </code>
      clause may be given to cast the
          input string to a nonbinary or binary string and to force it
          to a given length:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         <code class="literal">
          AS CHAR(
          <em class="replaceable">
           <code>
            N
           </code>
          </em>
          )
         </code>
         casts the string to a nonbinary string and pads it on the
              right with spaces to a length of
         <em class="replaceable">
          <code>
           N
          </code>
         </em>
         characters.
         <em class="replaceable">
          <code>
           N
          </code>
         </em>
         must be at least 1. If
         <em class="replaceable">
          <code>
           N
          </code>
         </em>
         is less than the length of
              the input string, the string is truncated to
         <em class="replaceable">
          <code>
           N
          </code>
         </em>
         characters. No warning occurs
              for truncation.
        </p>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          AS BINARY(
          <em class="replaceable">
           <code>
            N
           </code>
          </em>
          )
         </code>
         is similar but casts the string to a binary string,
         <em class="replaceable">
          <code>
           N
          </code>
         </em>
         is measured in bytes (not
              characters), and padding uses
         <code class="literal">
          0x00
         </code>
         bytes (not spaces).
        </p>
       </li>
      </ul>
     </div>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa1567566"><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 keyword">NAMES</span> <span class="token string">'latin1'</span><span class="token punctuation">;</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">WEIGHT_STRING</span><span class="token punctuation">(</span><span class="token string">'ab'</span> <span class="token keyword">AS</span> <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">4</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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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(WEIGHT_STRING('ab' AS CHAR(4))) <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>
<span class="token output"><span class="token punctuation">|</span> 41422020                            <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>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token keyword">NAMES</span> <span class="token string">'utf8mb4'</span><span class="token punctuation">;</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">WEIGHT_STRING</span><span class="token punctuation">(</span><span class="token string">'ab'</span> <span class="token keyword">AS</span> <span class="token datatype">CHAR</span><span class="token punctuation">(</span><span class="token number">4</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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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(WEIGHT_STRING('ab' AS CHAR(4))) <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>
<span class="token output"><span class="token punctuation">|</span> 1C471C60                            <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></code></pre>
     </div>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa1913234"><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">WEIGHT_STRING</span><span class="token punctuation">(</span><span class="token string">'ab'</span> <span class="token keyword">AS</span> <span class="token datatype">BINARY</span><span class="token punctuation">(</span><span class="token number">4</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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="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(WEIGHT_STRING('ab' AS BINARY(4))) <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>
<span class="token output"><span class="token punctuation">|</span> 61620000                              <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></code></pre>
     </div>
     <p>
      The
      <em class="replaceable">
       <code>
        flags
       </code>
      </em>
      clause currently is
          unused.
     </p>
     <p>
      If
      <a class="link" href="string-functions.html#function_weight-string">
       <code class="literal">
        WEIGHT_STRING()
       </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>
   </ul>
  </div>
 </div>
 <br/>
</div>
