title: SQL Select Convert State Name To Abbreviation
body: <p>In a SQL select statement, how to convert a full state name to state abbreviation (e.g. <code>New York</code> to <code>NY</code>)? I'd like to do this without joins if possible. What would the <code>regexp_replace</code> look like?</p>
  
  <p><code>select regexp_replace(table.state, 'New York', 'NY', 'g') as state</code><br/>
  Can this approach be done en mass for all states?</p>
  
  <p>For reference list of states names and abbreviations: <a href="https://gist.github.com/esfand/9443427" rel="nofollow noreferrer">https://gist.github.com/esfand/9443427</a>.</p>