title: Why can "WHERE col LIKE 'a%'" use an index, but not "WHERE col LIKE '%a%'"?
body: <p>I just found this post:</p>
  
  <p><a href="https://stackoverflow.com/questions/1938349/mysql-like-query-runs-extremly-slow-for-5000-records-table">MySQL like query runs extremly slow for 5000 records table</a></p>
  
  <p>And I'm interested in understanding asaph's post where he says: </p>
  
  <blockquote>
    <p>I wouldn't expect select * from customer where code like '%a%' to be
    fast since it couldn't possibly use an index. Every record has to be
    checked. Consider select * from customer where code like 'a%' if
    possible since that could feasibly use an index.</p>
  </blockquote>
  
  <p>Can someone explain the difference between the two select statements?  I know one has only one wildcard and will only find things that start with "a".  but why can that one be indexed?</p>