update part of a string in mysql code example
Example 1: update part of a string in mysql
UPDATE table
SET field = REPLACE(field, 'string', 'anothervalue')
WHERE field LIKE '%string%';
Example 2: update substring in mysql
SELECT Country, REPLACE(Country, 'States', 'Kingdom')
FROM Persons;
UPDATE tableName
SET Country = REPLACE(Country, 'States', 'Kingdom')
-- if Country = 'United States'
-- After replace = 'United Kingdom'