MySQL Replace function replace () implements MySQL replacement string MySQL replacement string implementation method: mysql Replace function directly replaces a specific string in a field in a MySQL database, and no longer needs to write its own function to replace it. It is very convenient to use. MySQL Replace function replace () UPDATE ' table_name ' SET ' field_name ' = replace (' Field_name ', ' from_str ', ' to_str ') WHERE ' Field_name ' Like '%from_str% ' Description: table_name--table name field_name--field name from_str--need to replace the string to_str-- Replace with string For example: mysql> SELECT REPLACE (' www.k686.com ', ' www ', ' http://www '); Change the www.k686.com inside the www to http://www ' http://www.k686.com ' the function is multi-byte safe, that is, you do not have to consider whether it is a Chinese character or English characters. instance Update ' mo_maintable ' set ' title ' = replace (' title ', ' Ming Wan cms ', ' AI station CMS '), ' subtitle ' = replace (' Subtitle ', ' Ming Wan cms ', ' AI station CMS '), ' keywords ' = replace (' keywords ', ' Ming Wan cms ', ' AI station CMS '), ' description ' = replace (' description ', ' Ming million cms ', ' AI station CMS '); update ' mo_maintable ' set ' title ' = replace (' title ', ' Ming Wan cms ', ' AI station CMS '), ' subtitle ' = Replace (' subtitle ', ' Ming Wan cms ', ' AI station CMS '), ' keywords ' = replace (' keywords ', ' Ming Wan cms ', ' AI station CMS '), ' description ' = replace (' Description ', ' Ming Wan cms ', ' AI station CMS '); update ' mo_article ' set ' content ' = replace (' content ', ' Ming Wan cms ', ' Love Station CMS '); update ' mo_article ' set ' content ' = replace (' content ', ' Ming Wan cms ', ' AI station CMS ');
MySQL note-replace () implements the MySQL replacement string