IFNULL in MySQL

If the expression is NULL, the IFNULL() function returns a specified alternative value. This function returns the expression if it is NOT NULL.

This function is typically used to return a different value in the event that a column’s value contains any NULLs.

Syntax:
IFNULL(expression, alt_value)

Example:
SELECT IFNULL(NULL, “bigdatansql.com”);
Result: bigdatansql.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s