Outdated Version
You are viewing an older version of this section. View current production version.
IFNULL
Returns the second argument if the first argument is NULL, else returns the first argument.
Syntax
IFNULL (val1, val2)
Arguments
- Any SQL objects
Return Type
- Default return type is the more general of the two given expressions, val1 and val2, in the order of:
string,real, orinteger.
Examples
memsql> select ifnull(NULL, 'plan b'), ifnull('plan a', 'plan b');
+------------------------+----------------------------+
| ifnull(NULL, 'plan b') | ifnull('plan a', 'plan b') |
+------------------------+----------------------------+
| plan b | plan a |
+------------------------+----------------------------+