The SQL syntax for IF branching looks like this:
IF condition THEN commands; [ELSE IF condition THEN commands;] [ELSE commands;] END IF;