# **FIND_IN_SET()**

## **Function Description**

- str is the string to query
- strList is the field name, and the parameters are separated by "," such as (1,2,6,8)
- Query the result contained in the field (strList), returning the result NULL or record.

If the string *str* is in a string list *strlist* composed of N substrings, the return value ranges from *1* to *N*. A string list is composed of substrings separated by the `,` symbol. If the first parameter is a constant string and the second parameter is a column of type ``SET``, the FIND_IN_SET()` function will be optimized to use bit operations. Returns *0* if *str* is not in *strlist* or *strlist* is an empty string. Returns ``NULL`` if either parameter is *NULL*. If the first parameter contains the comma ``(,)`` character, this function will not work properly.

## **Function Syntax**

```text
> FIND_IN_SET(str,strlist)
```

## **Parameter definition**

| Parameters | Description |
| ---- | ---- |
| str | Required parameters. Both CHAR and VARCHAR types are supported. |
| strlist | Required parameters. |

## **Example**

```text
select find_in_set('b','a,b,c,d');
+------------------------------+
| find_in_set(b, a,b,c,d) |
+------------------------------+
| 2 |
+------------------------------+
```
