Jump to: navigation, search

Mysql INSERT

From w3cyberlearnings

Contents

MySQL INSERT Function

This function inserts string with substring.

Syntax INSERT

  • Str: Main string input
  • Position: Insert position
  • Length: Length of the insert string
  • Substring: a given substring
INSERT(Str, Position, Length, substring);

Example 1

mysql> SELECT INSERT('Hello John',5,2,' ');
+------------------------------+
| INSERT('Hello John',5,2,' ') |
+------------------------------+
| Hell John                    |
+------------------------------+
1 row in set (0.00 sec)


Example 2

mysql> SELECT INSERT('Hello John',6,100,' a good man!');
+-------------------------------------------+
| INSERT('Hello John',6,100,' a good man!') |
+-------------------------------------------+
| Hello a good man!                         |
+-------------------------------------------+
1 row in set (0.00 sec)

Related Links


Navigation
Web
SQL
MISC
References