IFNULL¶
Grammar Description¶
If expr1 is not NULL, then IFNULL() returns expr1; otherwise expr2 is returned.
Grammar Structure¶
Text
> IFNULL(expr1,expr2)
Example¶
Text
mysql> SELECT IFNULL(NULL,10);
+------------------+
| ifnull(null, 10) |
+------------------+
| 10 |
+------------------+
1 row in set (0.01 sec)
Text
mysql> SELECT CAST(IFNULL(NULL, NULL) AS DECIMAL);
+-----------------------------------------+
| cast(ifnull(null, null) as decimal(38)) |
+-----------------------------------------+
| NULL |
+-----------------------------------------+
1 row in set (0.01 sec)
Last updated on