This tutorial explains how to use the MySQL INSTR function with syntax and examples.
The MySQL INSTR function returns the location of a substring in a string.
The syntax for the INSTR function in MySQL is:
INSTR( string, substring )
The string to search.
The substring to search for in string.
The INSTR function can be used in the following versions of MySQL:
Let's look at some MySQL INSTR function examples and explore how to use the INSTR function in MySQL.
For example:
mysql> SELECT INSTR('AODBA.com', 'B');
Output: 4
mysql> SELECT INSTR('AODBA.com', 'com');
Output: 7
mysql> SELECT INSTR('AODBA.com', 'Z');
Output: 0