MySQL REPLACE string function example
For example, if you want to correct the spelling mistake in the products table in the sample database, you use the REPLACE function as follows:
UPDATE products
SET
productDescription = REPLACE(productDescription,
'abuot',
'about');
The query finds all occurrences of a spelling mistake abuot and replaces it by the correct word about in the productDescription column of the products table.
It is very important to note that in the REPLACE function, the first parameter is the column name without quotes (“). If you put the quotes to the field name like “field_name”, the query will update the content of that column to “field_name”, which is causing unexpected data loss.