title: Case Expression vs Case Statement
body: <p>What is the difference between a <a href="http://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html#operator_case">Case Expression</a> and a <a href="http://dev.mysql.com/doc/refman/5.0/en/case.html">Case Statement</a> in MySQL? When can they be used, and what are the benefits of using one over the other?</p>
  
  <p>Case Statement syntax:</p>
  
  <pre><code>CASE
    WHEN search_condition THEN statement_list
    [WHEN search_condition THEN statement_list] ...
    [ELSE statement_list]
  END CASE
  </code></pre>
  
  <p>Case Expression syntax:</p>
  
  <pre><code>CASE 
    WHEN [condition] THEN result 
    [WHEN [condition] THEN result ...] 
    [ELSE result] 
  END
  </code></pre>
  
  <p>These look almost identical, but the initial description for Case Statements is that <code>The CASE statement for stored programs implements a complex conditional construct.</code></p>
  
  <p>So is the significant difference that one is used in stored programs and not usable in normal queries? I tried this out on a query I was playing with and it failed - <a href="http://sqlfiddle.com/#!2/9a1cb/8">sqlfiddle</a>. If this is the case though, why not just use the Case Expression in a stored program?</p>
  
  <p>Are there any other syntactical differences to be aware of, since they seem to be identical?</p>