Mysql Tutorial: Database character replacement and replace functions can be used when you want to REPLACE the content of a field in the database:
Syntax:
UPDATE tb1 SET f1 = REPLACE (f1, 'ABC', 'Def ');
REPLACE (str, from_str, to_str)
All the from_str strings in the str string are replaced by to_str, and the following string is returned:
Mysql> selectREPLACE ('www .mysql.com ', 'W', 'WW ');
-> 'Wwwwww .mysql.com'
This function is multi-byte secure.
Example:
UPDATE 'dede _ addonarticle' SET body = REPLACE (body,
'',
'');
UPDATE 'dede _ addonarticle' SET body = REPLACE (body,
'',
'');
UPDATE 'dede _ addonarticle' SET body = REPLACE (body,
'',
'');
UPDATE 'dede _ archives 'SET title = REPLACE (title,
'Dayang news -',
'');
UPDATE 'dede _ addonarticle' SET body = REPLACE (body,
'../../../../../../',
'Http: // special.dayoo.com/meal /');
Mysql replace
Usage 1. replace intoreplace into table (id, name) values ('1', 'A'), ('2', 'BB ')
This statement inserts two records into the table.
2. replace (object, search, replace)
Replace all search objects with replaceselect replace ('www .webjx.com ', 'W', 'WW') ---> www wWw.webjx.com
For example, replace aa in the name field of the table with bbupdate table set name = replace (name, 'AA', 'BB ')