Find and Replace Data in MySQL Database

mysql database find replace - ezeelive technologies

Find and Replace Data in MySQL Database

Here the below examples To find a string in a certain field and replace it with another string in MySql Database
Single Row :

update [table_name] set [field_name] = replace([field_name],'[string_to_find]','[string_to_replace]');

Multiple Row :

update [table_name] set [field_name_1] = replace([field_name_1],'[string_to_find_1]','[string_to_replace_1]'), [field_name_2] = replace([field_name_2],'[string_to_find_2]','[string_to_replace_2]') ....;

Condition :

update [table_name] set [field_name] = replace([field_name],'[string_to_find]','[string_to_replace]') WHERE [condition];

Leave a Reply

Your email address will not be published. Required fields are marked *