title: One field search for multiple values
body: <p>What is the best and optimised way to write a SQL query to search for a term with multiple columns in a table?</p>
  
  <p>For example I have a table of products:</p>
  
  <pre><code>id | title   | color_id
  -------------------
   1 | Dress   | 1 (red)
   2 | T-shirt | 3 (blue)
   3 | Pants   | 2 (green)
   4 | Socks   | 1 (red)
   5 | Dress   | 2 (green)
   6 | Shoes   | 2 (green)
   7 | Pants   | 3 (blue)
  </code></pre>
  
  <p>And a table of colors:</p>
  
  <pre><code>id | color
  ----------
   1 | Red
   2 | Green
   3 | Blue
  </code></pre>
  
  <p>And if a user enters in the term <strong>Red dress</strong>, as a result (s)he must see <code>Product</code> with id <code>1</code>, and if user enters simply <strong>Red</strong>, as a result (s)he must see <code>Products</code> with id <code>1</code> and <code>4</code>.</p>
  
  <p><strong>Update:</strong> There may be some inputs like <code>dress red</code> or <code>red blue</code> too.</p>
  
  <p>Real version of tables are more complex, but I tried to explain in a simplest way.</p>