<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="ansi-diff-select-into-table">
      </a>
      1.7.2.1 SELECT INTO TABLE Differences
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045333276016">
  </a>
  <p>
   MySQL Server doesn't support the
   <code class="literal">
    SELECT ... INTO
          TABLE
   </code>
   Sybase SQL extension. Instead, MySQL Server
          supports the
   <a class="link" href="insert-select.html" title="15.2.7.1 INSERT ... SELECT Statement">
    <code class="literal">
     INSERT INTO ...
          SELECT
    </code>
   </a>
   standard SQL syntax, which is basically the
          same thing. See
   <a class="xref" href="insert-select.html" title="15.2.7.1 INSERT ... SELECT Statement">
    Section 15.2.7.1, “INSERT ... SELECT Statement”
   </a>
   . For example:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa99774103"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> tbl_temp2 <span class="token punctuation">(</span>fld_id<span class="token punctuation">)</span>
    <span class="token keyword">SELECT</span> tbl_temp1<span class="token punctuation">.</span>fld_order_id
    <span class="token keyword">FROM</span> tbl_temp1 <span class="token keyword">WHERE</span> tbl_temp1<span class="token punctuation">.</span>fld_order_id <span class="token operator">&gt;</span> <span class="token number">100</span><span class="token punctuation">;</span></code></pre>
  </div>
  <p>
   Alternatively, you can use
   <a class="link" href="select-into.html" title="15.2.13.1 SELECT ... INTO Statement">
    <code class="literal">
     SELECT ... INTO
          OUTFILE
    </code>
   </a>
   or
   <a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
    <code class="literal">
     CREATE TABLE ...
          SELECT
    </code>
   </a>
   .
  </p>
  <p>
   You can use
   <a class="link" href="select.html" title="15.2.13 SELECT Statement">
    <code class="literal">
     SELECT ...
          INTO
    </code>
   </a>
   with user-defined variables. The same syntax
          can also be used inside stored routines using cursors and
          local variables. See
   <a class="xref" href="select-into.html" title="15.2.13.1 SELECT ... INTO Statement">
    Section 15.2.13.1, “SELECT ... INTO Statement”
   </a>
   .
  </p>
 </div>
 <br/>
</div>
