MySQL note-replace () implements the MySQL replacement string

Source: Internet
Author: User
Tags ming

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.