Skip to main content


Accepts exactly two arguments and returns the first non NULL argument, can be used to substitute a default value for a NULL value.

The IFNULL function is equivalent to the COALESCE function with two arguments only, the COALESCE function can have more than two arguments.

See also:


SELECT IFNULL(expression1, expression2) FROM <multipartIdentifier>;


Two expressions of any data type which resolve to a NULL or non NULL value.

If both expression arguments are NULL, the IFNULL function returns NULL.

Return Value(s)

Returns the first non NULL value from the two expression arguments.


Replace a NULL value with a default value

SELECT name, ifnull(website, 'Not hosting a website') AS website 
FROM where project = 'stackql';

For more information, see