We know that by default, the search in the LOCATE() function starts from the beginning. We can manage the starting position by giving a parameter to specify the position in the string where we want to start the search. The following example will demonstrate it -
mysql> Select LOCATE('good','Ram is a good boy. Is Ram a good boy?',11)As Result; +--------+ | Result | +--------+ | 29 | +--------+ 1 row in set (0.00 sec)
In the above example, we have given the value 11 as the positional parameter. This means that MySQL will start searching from the 11th position.
The above is the detailed content of How to manage the starting position of the search in the MySQL LOCATE() function?. For more information, please follow other related articles on the PHP Chinese website!