replace query in mysql code example

Example 1: mysql replace a character in a string

UPDATE users SET first_name = REPLACE (first_name, 'search', 'replace_with') where id > 0;

Example 2: mysql replace text

UPDATE
    table_name
SET
    column_name = REPLACE(column_name, 'text to find', 'text to replace with')
WHERE
    column_name LIKE '%text to find%';

Example 3: mysql replace

REPLACE(str, find_string, replace_with)

Example 4: mysql replace string in table

UPDATE products 
SET 
    productDescription = REPLACE(productDescription,
        'abuot',
        'about');

Example 5: update and replace mysql

#Search, Update & Replace Query

UPDATE `tblname` SET `description`= REPLACE(`description`, 'old name', 'New Name') WHERE `description` LIKE '%old name%';

Example 6: search for replace in mysql

UPDATE products SET 
productDescription = REPLACE(productDescription,'abuot','about');

Tags:

Sql Example