Flow Control Functions • SET  and  ENUM  are treated similar to  VARCHAR ; the result is  VARCHAR . •If all types are  JSON , the result is  JSON . •If all types are temporal, the result is temporal: •If all temporal types are  DATE ,  TIME , or  TIMESTAMP , the result is  DATE ,  TIME , or  TIMESTAMP , respectively. •Otherwise, for a mix of temporal types, the result is  DATETIME . •If all types are  GEOMETRY , the result is  GEOMETRY . •If any type is  BLOB , the result is  BLOB . •For all other type combinations, the result is  VARCHAR . •Literal  NULL  operands are ignored for type aggregation. • IF( expr1 , expr2 , expr3 ) mysql>  SELECT CASE 1 WHEN 1 THEN ’one’ -> WHEN 2 THEN ’two’ ELSE ’more’ END; -> ’one’ mysql>  SELECT CASE WHEN 1>0 THEN ’true’ ELSE ’false’ END; -> ’true’ mysql>  SELECT CASE BINARY ’B’ -> WHEN ’a’ THEN 1 WHEN ’b’ THEN 2 END; -> NULL If  expr1  is  TRUE  ( expr1  <> 0  and  expr1  <> NULL ),  IF()  returns  expr2 . Otherwise, it returns expr3 . There is also an  IF statement , which differs from the  IF() function  described here. See Section 13.6.5.2, “IF Statement” . If only one of  expr2  or  expr3  is explicitly  NULL , the result type of the  IF()  function is the type of the non- NULL  expression. The default return type of  IF()  (which may matter when it is stored into a temporary table) is calculated as follows: Note •If  expr2  or  expr3  produce an integer, the result is an integer. •If  expr2  or  expr3  produce a floating-point value, the result is a floating-point value. •If  expr2  or  expr3  produce a string, the result is a string. If  expr2  and  expr3  are both strings, the result is case-sensitive if either string is case-sensitive. mysql>  SELECT IF(1>2,2,3); -> 3 mysql>  SELECT IF(1<2,’yes’,’no’); -> ’yes’ mysql>  SELECT IF(STRCMP(’test’,’test1’),’no’,’yes’); -> ’no’ 2136