-- Replace '.' in 'a.b.c' with '+'.
MySQL > SELECT replace('a.b.c', '.', '+');
+----------------------------+
| replace('a.b.c', '.', '+') |
+----------------------------+
| a+b+c |
+----------------------------+
-- No matching characters are found and the original string is returned.
MySQL > SELECT replace('a b c', '', '*');
+----------------------------+
| replace('a b c', '', '*') |
+----------------------------+
| a b c |
+----------------------------+
-- Replace 'like' with an empty string.
MySQL > SELECT replace('We like StarRocks', 'like', '');
+------------------------------------------+
| replace('We like StarRocks', 'like', '') |
+------------------------------------------+
| We StarRocks |
+------------------------------------------+
-- No matching characters are found and the original string is returned.
MySQL > SELECT replace('He is awesome', 'handsome', 'smart');
+-----------------------------------------------+
| replace('He is awesome', 'handsome', 'smart') |
+-----------------------------------------------+
| He is awesome |
+-----------------------------------------------+