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.

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)

Updated on: 20-Jun-2020

233 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements