title: start mysql query with IF
body: <p>According to mysql website i should be able to start a query with an if statement.</p>
  
  <pre><code>IF search_condition THEN statement_list
  [ELSEIF search_condition THEN statement_list] ...
  [ELSE statement_list]
  END IF
  </code></pre>
  
  <p>but when i try this query </p>
  
  <pre><code>if (count(1)
  FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS 
  WHERE TABLE_SCHEMA = 'dbname'
  AND TABLE_NAME='tblname'
  AND CONSTRAINT_NAME = 'con_name')
  then
  alter table table drop foreign key constraint_name;
  end if
  </code></pre>
  
  <p>i get a syntax error saying i have the wrong syntax near "IF" and mysql workbench highlights the if saying syntax error, unexpected if.</p>
  
  <p>i've tried with begin if, and omitting both begin and end if but the error is always the same.</p>