Computer >> Computer tutorials >  >> Programming >> MySQL

What MySQL COALESCE() function returns if it has a blank, but not NULL, as the first argument?


MySQL COALESCE() function returns the blank if it has a blank as the first argument. It is because blank is also a non-NULL value and we know that COALESCE function always returns first non-NULL value as a result. Following example would demonstrate it −

Example

mysql> Select COALESCE('','Ram');
+--------------------+
| COALESCE('','Ram') |
+--------------------+
|                    |
+--------------------+
1 row in set (0.00 sec)