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

MySQLMySQLi Database

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.

Syntax

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.

Example

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)
raja
Published on 20-Feb-2018 10:45:28
Advertisements