title: Syntax error at or near “case” when using a case statement
body: <p>I have the following SQL query (in PostgreSQL) and I keep getting a syntax error. </p>
  
  <pre><code>SELECT data1, data1_class
  CASE
      WHEN data1 LIKE '%Bookmarked Removed%' THEN 'Class I'
      ELSE 'Class II'
  END
  AS data1_class
  from events
  WHERE event_code = 11
  </code></pre>
  
  <p>The syntax error I get is:</p>
  
  <pre><code>  ERROR:  syntax error at or near "CASE"
    LINE 2:     CASE
          ^
    ********** Error **********
  
    ERROR: syntax error at or near "CASE"
    SQL state: 42601
    Character: 31
  </code></pre>
  
  <p>To me, I don't think that there is an error and this should work however after trying to work it out a few times I can't it to work.</p>
  
  <p>What am I missing from my CASE statement to make it work?</p>