Jump to: navigation, search

Mysql REPLACE

From w3cyberlearnings

Contents

MySQL REPLACE Function

This function returns a replace string.

Syntax REPLACE

  • Str: A String input
  • Find: Word or string looking for within Str
  • Replace: Replace with
REPLACE(Str,Find,Replace);

Example 1

mysql> SELECT REPLACE('girl is good','girl','boy');
+--------------------------------------+
| REPLACE('girl is good','girl','boy') |
+--------------------------------------+
| boy is good                          |
+--------------------------------------+
1 row in set (0.00 sec)

Example 2

mysql> SELECT REPLACE('a goes for b, and a is nothing to see','a','A');
+----------------------------------------------------------+
| REPLACE('a goes for b, and a is nothing to see','a','A') |
+----------------------------------------------------------+
| A goes for b, And A is nothing to see                    |
+----------------------------------------------------------+
1 row in set (0.00 sec)

Related Links


Navigation
Web
SQL
MISC
References