title: Searching names with SQL
body: <p>I am trying to return people from a search string that can consist of any variation of a name, such as: 'john', 'john smith', 'smith, john', 'john jason smith', or any other common variation. I can cleanup the string and format as a regular expression if need be. </p>
  
  <p>I am aiming for something similar to this:</p>
  
  <pre><code>SELECT firstname, 
         middlename, 
         lastname 
  FROM   people 
  WHERE  firstname LIKE 'search' 
          OR middlename LIKE 'search' 
          OR lastname LIKE 'search'; 
  </code></pre>
  
  <p>The problem is that a search string such as 'john smith' will return all <strong>johns</strong> and all <strong>smiths</strong> instead of only <strong>john smith</strong>. Any ideas?</p>