title: How to remove leading and trailing whitespace in a MySQL field?
body: <p>I have a table with two fields (countries and ISO codes):</p>
  
  <pre><code>Table1
  
     field1 - e.g. 'Afghanistan' (without quotes)
     field2 - e.g. 'AF'(without quotes)
  </code></pre>
  
  <p>In some rows the second field has whitespace at the start and/or end, which is affecting queries. </p>
  
  <pre><code>Table1
  
     field1 - e.g. 'Afghanistan' (without quotes) 
     field2 - e.g. ' AF' (without quotes but with that space in front)
  </code></pre>
  
  <p>Is there a way (in SQL) to go through the table and find/replace the whitespace in field2?</p>