title: Convert mysql query results to CSV (with copy/paste)
body: <p>I often work in command line mysql. A common need is to take a query's results and import them into a <a href="http://www.apple.com/iwork/numbers/" rel="noreferrer">Numbers</a> document (similar to an Excel document). </p>
  
  <p>What is the fastest method for doing this?</p>
  
  <h3>Method 1: Select into outfile</h3>
  
  <p>You can select into an outfile directly from MySQL, but this takes several steps.</p>
  
  <ol>
  <li>export your query with all the necessary arguments to make it a CSV format, like <code>FIELDS OPTIONALY ENCLOSED BY</code> and <code>DELIMITED BY</code>. </li>
  <li>sftp into the server and grab the file</li>
  <li>delete the file from the server</li>
  </ol>
  
  <h3>Method 2: Copy/paste</h3>
  
  <p>I tend to do this method. For me it seems a little faster but that's mostly because I don't remember how to construct the <code>SELECT INTO OUTFILE</code> query from above and have to look it up. </p>
  
  <ol>
  <li>Copy/paste to a local text file</li>
  <li>Open in a text editor and replace | with ,</li>
  <li>Save as a CSV and open in Numbers.</li>
  </ol>