Outdated Version
You are viewing an older version of this section. View current production version.
NULLIF
Returns NULL if the arguments are equal, otherwise the first argument.
NULLIF (val1, val2)
Arguments
- Any SQL objects
Return Type
The first argument if unequal, and NULL if equal.
Examples
memsql> select nullif(1,2);
+-------------+
| nullif(1,2) |
+-------------+
| 1 |
+-------------+
memsql> select nullif(2,2);
+-------------+
| nullif(2,2) |
+-------------+
| NULL |
+-------------+
memsql> select nullif(NULL, NULL);
+--------------------+
| nullif(NULL, NULL) |
+--------------------+
| NULL |
+--------------------+
memsql> select NULL = NULL;
+-------------+
| NULL = NULL |
+-------------+
| NULL |
+-------------+