IF search_condition THEN statement(s) [ELSEIF search_condition THEN statement(s)] ... [ELSE statement(s)] END IF
IF
implements a basic conditional
construct. If the search_condition
evaluates to true, the corresponding SQL statement is
executed. If no search_condition
matches,
the statement in the ELSE
clause is
executed.
Please note that there is also an IF()
function. See Secção 6.3.1.4, “Funções de Fluxo de Controle”.
This is a translation of the MySQL Reference Manual that can be found at dev.mysql.com. The original Reference Manual is in English, and this translation is not necessarily as up to date as the English version.