The if statement (in a saved block):
IF search_condition THEN statement_list
[ELSEIF search_condition THEN statement_list] ...
[ELSE statement_list]
END IF
Or the if function (in line):
IF(expr1,expr2,expr3)
:
IF (, what_to_do_if_true, what_to_do_if_false)
"else". if-else-if :
SELECT IF( id==1, "1", IF( ID==2, "2", "Neither" );
, :
if( id == 1 ) {
print "1"
} elsif( id == 2 ) {
print "2"
} else {
print "Neither"
}