Comparison Functions,Tests, Branching
COALESCE(x, y, z, ...) Returns the first parameter that is not NULL.
GREATEST(x, y, z, ...) Returns the greatest value or greatest character string.
IF(expr, val1, val2) Returns val1 if expr is true; otherwise, val2.
IFNULL(expr1, expr2) Returns expr2 if expr1 is NULL; otherwise, expr1.
INTERVAL(x, n1, n2, ...) Returns 0 if x<n1; 1 if x< n2, etc.; all parameters must be integers, and n1 < n2 < ... must hold.
ISNULL(x) Returns 1 or 0, according to whether x IS NULL holds.
LEAST(x, y, z, ...) Returns the smallest value or smallest character string.
STRCMP(s1, s2) Returns 0 if s1=s2 in sort order, -1 if s1<s2, 1 if s1>s2.
Related examples in the same category