Name

REPLACE()

Synopsis

REPLACE(str, from, to)

Returns the string str with all occurrences of the string from replaced with the string to. The search and replace is case-sensitive when searching for from. This code returns the string “Cheeseburger and Coke”:

SELECT REPLACE('Cheeseburger and Fries', 'Fries', 'Coke');

Get Learning PHP, MySQL, and JavaScript 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.