title: MySQL where like with multiple words and order by weight
body: <p>Let's have a simple InnoDB table <code>questions</code> containing one column <code>text</code>, which contains following data:</p>
  
  <pre><code>What color does the sun have?
  What year it is?
  What year was Barack Obama born?
  Where in europe people speak french?
  When stackoverflow started?
  </code></pre>
  
  <p>Now, I would like to search through this column:</p>
  
  <pre><code>SELECT *
  FROM `questions`
  WHERE `text` LIKE '%What%' OR `text` LIKE '%year%';
  </code></pre>
  
  <p>However this generate output:</p>
  
  <pre><code>What color does the sun have?
  What year it is?
  What year was Barack Obama born?
  </code></pre>
  
  <p>I would like the output ordered by the occurence of searched words. In another words when question contains both "What" and "year" it should precedes questions that contain "What" only. So the output would look like this:</p>
  
  <pre><code>What year it is?
  What year was Barack Obama born?
  What color does the sun have?
  </code></pre>
  
  <p>Can that be done using MySQL only? If not is there a nice way of doing this using PHP?</p>