What is the use of FIND_IN_SET () function in MySQL?

FIND_IN_SET() function, as name specified, is used to search the specified string from the list of string. Basically it returns the position of a string, if it is present (as a substring), within a list of strings.


FIND_IN_SET(Search String, string list)

Here, search string is the string which is to be searched and string list is the string that contains the substrings separated by commas.


mysql> Select FIND_IN_SET('good','Ram,is,a,good,boy');

| FIND_IN_SET('good','Ram,is,a,good,boy') |
|                                       4 |

1 row in set (0.00 sec)