
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How can I manage the start position of searching in MySQL LOCATE() function?
As we know that by default searching in LOCATE() function starts from beginning. We can manage the start position by giving an argument to specify the position from which we want to start the search in string. Following example will demonstrate it −
Example
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 argument for position. It means that MySQL will start searching from 11th position.
- Related Articles
- How can I start MySQL Server?
- How LOCATE() function can be used with MySQL WHERE clause?
- How MySQL LOCATE() function is different from its synonym functions i.e. POSITION() and INSTR() functions?
- What is the use of LOCATE() function in MySQL?
- How can I use IFNULL() function at the place of COALESCE() function in MySQL?
- What happens if I will use integer values as arguments of MySQL LOCATE() function?
- When MySQL LOCATE() function returns NULL as the output?
- How can I dynamically set the position of view in android?
- How can I determine the position of a Toplevel in Tkinter?
- How can I use another MySQL function/s with REPEAT() function?
- How can we start MySQL event scheduler?
- How MySQL manage the behavior of a transaction?
- Which MySQL functions work as similar as LOCATE() function?
- How can I use MySQL IN() function to compare row constructors?
- How can I use SPACE() function with MySQL WHERE clause?

Advertisements