Home > Database > Mysql Tutorial > How to replace letters in mysql

How to replace letters in mysql

藏色散人
Release: 2020-11-03 10:20:23
Original
3113 people have browsed it

In mysql, you can use the replace function to replace letters, and its syntax is such as "mysql> UPDATE `dede` SET body = REPLACE (body, '', '' );".

How to replace letters in mysql

Recommended: "mysql video tutorial"

mysql replacement string

The replace function in mysql directly replaces a specific string in a field in the mysql database. You no longer need to write a function to replace it. It is very convenient to use. mysql replacement function replace()

UPDATE table_name  SET field_name = REPLACE ( field_name , 'from_str', 'to_str' );
Copy after login

Description:

table_name - the name of the table

field_name - the field name

from_str - needs to be replaced String

to_str ——The string replaced by

For example:

mysql> UPDATE `dede` SET body = REPLACE ( body, &#39;</td>&#39;, &#39;&#39; );
Copy after login

This function is multi-byte safe, which means you don’t have to consider whether it is Chinese characters or English characters.

The above is the detailed content of How to replace letters in mysql. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template