跳到主要内容

REPLACE

Returns the string str with all occurrences of the string from_str replaced by the string to_str.

Syntax

REPLACE(str,from_str,to_str)

Arguments

ArgumentsDescription
strThe string.
from_strThe from string.
to_strThe to string.

Return Type

A String data type value.

Examples

SELECT REPLACE('www.mysql.com', 'w', 'Ww');
+-------------------------------------+
| REPLACE('www.mysql.com', 'w', 'Ww') |
+-------------------------------------+
| WwWwWw.mysql.com |
+-------------------------------------+