LOCATE(substr,str), LOCATE(substr,str,pos)
LOCATE function returns the position of first occurrence substring in passed string. The second syntax returns the first occurrence of substring after the given position (the thirds parameter of second syntax). It returns 0 if the substr is not in string.
Here are some example which will explain these above 2 functions-
mysql> SELECT LOCATE('bar', 'foobarbar');
-> 4
mysql> SELECT LOCATE('xbar', 'foobar');
-> 0
mysql> SELECT LOCATE('bar', 'foobarbar', 5);
-> 7
0 Comment(s)