Most of people thinks IN() and FIND_IN_SET() MySQL functions are identical and do the same job.
But they not. You may be confused with them or don’t know when to use IN() or FIND_IN_SET().There are specific situation for both MySQL functions.
To understand it better assume a table user
|1||Hitesh Shrimali||29||Green, Blue|
|2||Jeetendra Sharma||31||Blue, Pink|
|3||Ram Singh||29||Red, Blue|
IN() mysql Function
This function is used when we want to compare field (which contain single value) with list of values in database.
Example – Select * From user Where userid IN (1, 2);
Result – query will return 2 rows with userid 1 and 2.
FIND_IN_SET() mysql function
This function is used when any field holds comma separated values in it and we want to compare it with single value.
Example – Select * From user Where FIND_IN_SET(“green”, fav_color);
Result – query will return 1 row with userid 1.
I hope these will clear your confusion and help you to decide when to use one of them.