Name
REPLACE()
Synopsis
REPLACE(string
,old_element
,new_element
)
This function goes through the first argument and returns a string in which every occurrence of the second argument is replaced with the third argument. Here is an example:
UPDATE students, REPLACE(title, 'Mrs.', 'Ms.');
This SQL statement will retrieve each student’s title and
replace any occurrences of “Mrs.” with “Ms.” UPDATE
will change only the rows where the replacement was made.
Get MySQL in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.