Sep 17, 2018

MySQL IFNULL() function lets you return an alternative value if an expression is NULL.

MySQL IFNULL() takes two expressions and if the first expression is not NULL, it returns the first expression. Otherwise, it returns the second expression.


IFNULL(expression, alt_value)

Parameter Values

Parameter Description
expression Required. The value to test whether is NULL
alt_value Required. The value to return if expression is a NULL value


  • The IFNULL() function returns the alt_value, if the expression is a NULL
  • The IFNULL() function returns the expression, if the expression is NOT NULL