Jump to: navigation, search

Mysql INSTR

From w3cyberlearnings

Contents

MySQL INSTR Function

This function returns the position of the first occurrence of substring in string.

Syntax INSTR

  • STR: A string input
  • SubString: Substring
INSTR(STR, SubString);

Example 1: ve is at position 3

mysql> SELECT INSTR('lovely','ve');
+----------------------+
| INSTR('lovely','ve') |
+----------------------+
|                    3 |
+----------------------+
1 row in set (0.00 sec)

Example 2: She at position 1

mysql> SELECT INSTR('she loves it','she');
+-----------------------------+
| INSTR('she loves it','she') |
+-----------------------------+
|                           1 |
+-----------------------------+
1 row in set (0.00 sec)

Related Links


Navigation
Web
SQL
MISC
References