When MySQL FIND_IN_SET() function returns NULL as output?


FIND_IN_SET() function returns NULL as output if any of the argument i.e. either search string or string list, is NULL. Of course, It will also return NULL if both of the arguments are NULL.

Example

mysql> Select FIND_IN_SET(NULL,'Ram is a good boy') AS Result;
+--------+
| Result |
+--------+
| NULL   |
+--------+
1 row in set (0.00 sec)

mysql> SELECT FIND_IN_SET('RAM',NULL)AS RESULT;
+--------+
| RESULT |
+--------+
| NULL   |
+--------+
1 row in set (0.00 sec)

mysql> SELECT FIND_IN_SET(NULL,NULL);
+------------------------+
| FIND_IN_SET(NULL,NULL) |
+------------------------+
|                   NULL |
+------------------------+
1 row in set (0.00 sec)

Updated on: 20-Jun-2020

208 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements