INSTR() FUNCTION in MySQL

INSTR() FUNCTION The MySQL INSTR function is used to get the location of a substring in a string. The various versions of MySQL supports the INSTR function, namely, MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0 and MySQL 3.23.

Syntax:

INSTR( string, substring )

Parameters: string: It is used to specify the string to search. substring: It is used to specify the substring to search for.

Example:

mysql> SELECT INSTR ( 'HELLO WORLD', ‘L’);

Output:

3

Explanation: The first occurrence of the substring is at the 3rd position in the string and so is the result.

Please follow and like us:
Content Protection by DMCA.com