Home  >  Article  >  Database  >  How to replace characters in mysql

How to replace characters in mysql

coldplay.xixi
coldplay.xixiOriginal
2020-10-12 11:52:0013733browse

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!

Statement:
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