According to mysql website i should be able to start a query with an if statement.

```
IF search_condition THEN statement_list
[ELSEIF search_condition THEN statement_list] ...
[ELSE statement_list]
END IF

```

but when i try this query 

```
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

```

i get a syntax error saying i have the wrong syntax near "IF" and mysql workbench highlights the if saying syntax error, unexpected if.

i've tried with begin if, and omitting both begin and end if but the error is always the same.