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

MySQLMySQLi Database

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)
raja
Published on 20-Feb-2018 18:27:50
Advertisements