<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="selecting-all">
      </a>
      5.3.4.1 Selecting All Data
     </h4>
    </div>
   </div>
  </div>
  <p>
   The simplest form of
   <a class="link" href="select.html" title="15.2.13 SELECT Statement">
    <code class="literal">
     SELECT
    </code>
   </a>
   retrieves everything from a table:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa2731599"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> pet<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 class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> name     <span class="token punctuation">|</span> owner  <span class="token punctuation">|</span> species <span class="token punctuation">|</span> sex  <span class="token punctuation">|</span> birth      <span class="token punctuation">|</span> death      <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 class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> Fluffy   <span class="token punctuation">|</span> Harold <span class="token punctuation">|</span> cat     <span class="token punctuation">|</span> f    <span class="token punctuation">|</span> 1993<span class="token punctuation">-</span>02<span class="token punctuation">-</span>04 <span class="token punctuation">|</span> NULL       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Claws    <span class="token punctuation">|</span> Gwen   <span class="token punctuation">|</span> cat     <span class="token punctuation">|</span> m    <span class="token punctuation">|</span> 1994<span class="token punctuation">-</span>03<span class="token punctuation">-</span>17 <span class="token punctuation">|</span> NULL       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Buffy    <span class="token punctuation">|</span> Harold <span class="token punctuation">|</span> dog     <span class="token punctuation">|</span> f    <span class="token punctuation">|</span> 1989<span class="token punctuation">-</span>05<span class="token punctuation">-</span>13 <span class="token punctuation">|</span> NULL       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Fang     <span class="token punctuation">|</span> Benny  <span class="token punctuation">|</span> dog     <span class="token punctuation">|</span> m    <span class="token punctuation">|</span> 1990<span class="token punctuation">-</span>08<span class="token punctuation">-</span>27 <span class="token punctuation">|</span> NULL       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Bowser   <span class="token punctuation">|</span> Diane  <span class="token punctuation">|</span> dog     <span class="token punctuation">|</span> m    <span class="token punctuation">|</span> 1979<span class="token punctuation">-</span>08<span class="token punctuation">-</span>31 <span class="token punctuation">|</span> 1995<span class="token punctuation">-</span>07<span class="token punctuation">-</span>29 <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Chirpy   <span class="token punctuation">|</span> Gwen   <span class="token punctuation">|</span> bird    <span class="token punctuation">|</span> f    <span class="token punctuation">|</span> 1998<span class="token punctuation">-</span>09<span class="token punctuation">-</span>11 <span class="token punctuation">|</span> NULL       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Whistler <span class="token punctuation">|</span> Gwen   <span class="token punctuation">|</span> bird    <span class="token punctuation">|</span> NULL <span class="token punctuation">|</span> 1997<span class="token punctuation">-</span>12<span class="token punctuation">-</span>09 <span class="token punctuation">|</span> NULL       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Slim     <span class="token punctuation">|</span> Benny  <span class="token punctuation">|</span> snake   <span class="token punctuation">|</span> m    <span class="token punctuation">|</span> 1996<span class="token punctuation">-</span>04<span class="token punctuation">-</span>29 <span class="token punctuation">|</span> NULL       <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">|</span> Puffball <span class="token punctuation">|</span> Diane  <span class="token punctuation">|</span> hamster <span class="token punctuation">|</span> f    <span class="token punctuation">|</span> 1999<span class="token punctuation">-</span>03<span class="token punctuation">-</span>30 <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 class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
  </div>
  <p>
   This form of
   <a class="link" href="select.html" title="15.2.13 SELECT Statement">
    <code class="literal">
     SELECT
    </code>
   </a>
   uses
   <code class="literal">
    *
   </code>
   , which is shorthand for
   <span class="quote">
    “
    <span class="quote">
     select all
          columns.
    </span>
    ”
   </span>
   This is useful if you want to review your
          entire table, for example, after you've just loaded it with
          your initial data set. For example, you may happen to think
          that the birth date for Bowser doesn't seem quite right.
          Consulting your original pedigree papers, you find that the
          correct birth year should be 1989, not 1979.
  </p>
  <p>
   There are at least two ways to fix this:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      Edit the file
      <code class="filename">
       pet.txt
      </code>
      to correct the
              error, then empty the table and reload it using
      <a class="link" href="delete.html" title="15.2.2 DELETE Statement">
       <code class="literal">
        DELETE
       </code>
      </a>
      and
      <a class="link" href="load-data.html" title="15.2.9 LOAD DATA Statement">
       <code class="literal">
        LOAD DATA
       </code>
      </a>
      :
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa83899697"><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">DELETE</span> <span class="token keyword">FROM</span> pet<span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">LOAD</span> <span class="token keyword">DATA</span> <span class="token keyword">LOCAL</span> <span class="token keyword">INFILE</span> <span class="token string">'pet.txt'</span> <span class="token keyword">INTO</span> <span class="token keyword">TABLE</span> pet<span class="token punctuation">;</span></code></pre>
     </div>
     <p>
      However, if you do this, you must also re-enter the record
              for Puffball.
     </p>
    </li>
    <li class="listitem">
     <p>
      Fix only the erroneous record with an
      <a class="link" href="update.html" title="15.2.17 UPDATE Statement">
       <code class="literal">
        UPDATE
       </code>
      </a>
      statement:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa21935260"><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> pet <span class="token keyword">SET</span> birth <span class="token operator">=</span> <span class="token string">'1989-08-31'</span> <span class="token keyword">WHERE</span> <span class="token keyword">name</span> <span class="token operator">=</span> <span class="token string">'Bowser'</span><span class="token punctuation">;</span></code></pre>
     </div>
     <p>
      The
      <a class="link" href="update.html" title="15.2.17 UPDATE Statement">
       <code class="literal">
        UPDATE
       </code>
      </a>
      changes only the
              record in question and does not require you to reload the
              table.
     </p>
    </li>
   </ul>
  </div>
  <p>
   There is an exception to the principle that
   <code class="literal">
    SELECT
          *
   </code>
   selects all columns. If a table contains invisible
          columns,
   <code class="literal">
    *
   </code>
   does not include them. For more
          information, see
   <a class="xref" href="invisible-columns.html" title="15.1.20.10 Invisible Columns">
    Section 15.1.20.10, “Invisible Columns”
   </a>
   .
  </p>
 </div>
 <br/>
</div>
