IF Statement
Inside procedures: IF marks < 40 THEN SET msg = 'fail'; ELSE SET msg = 'pass'; END IF; This is not the IF() function. You need BEGIN … END and DELIMITER when creating the procedure.
Trap — writing IF THEN in a normal query tab. That’s a syntax error. Use IF() or CASE in SELECT.
On the example next to this theory: IF Statement: create two demo rows, then SELECT qty >= 2 ordered. Say which labels come back.
Exam tip
IF THEN is for procedures. SELECT uses IF() / CASE.