Home > Database > Mysql Tutorial > body text

How to replace characters in mysql

coldplay.xixi
Release: 2020-10-12 11:52:00
Original
13740 people have browsed it

How to replace characters in mysql: use update to replace, the code is [UPDATE table name SET the field you want to replace = replace (the field you want to replace, ' ', '')].

How to replace characters in mysql

##More related free learning recommendations: mysql tutorial(Video)

How to replace characters in mysql:

1. There are many spaces in the searched data. It will be particularly inconvenient if you export the data. Just use a single update statement. For example, if you remove the spaces, you can write it as

UPDATE table name SET The field you want to replace = replace(the field you want to replace, ' ', '') .

How to replace characters in mysql

2. For example, if I want to replace the spaces in the title, I write UPDATE car_articles SET article_title = replace(article_title, ' ', ''). The result is as follows, there will be no spaces. .

How to replace characters in mysql

#3. If you want to replace a certain character with another one in batches. For example, change the field with "Beijing" to Shanghai. Just write UPDATE car_brands SET name = replace(name, 'Beijing', 'Shanghai')

How to replace characters in mysql

The above is the detailed content of How to replace characters 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!