MySql – search and replace a string in a column

If we and to search some specific string inside our column data and replace it with other string then we can use replace query of MySql.

Suppose table name is ‘users’ and we want to search city column with a value ‘London’ and replace it with ‘New York’

update users set city = replace(city, 'London', 'New york');

 

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.