In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
In this issue, the editor will bring you some data about how to replace a field in batches in Mysql. The article is rich in content and analyzed and described from a professional point of view. I hope you can get something after reading this article.
1. Modify all the text in the field that contains the specified string
UPDATE Table A SET field B = replace (field B, 'aaa',' bbb') example: update table set url= replace (url,' aaa', 'bbb') [change the aaa batch in the url field to bbb] update table set url= REPLACE (url,'3','1.png') where condition
two。 General condition modification:
Update table set column='' where column is null column: update `table` set `url` ='0' where `url` is null
Additional knowledge: mysql replaces parts of a field in batches
Give examples to illustrate
There is a data table person, which is structured as follows
Idnameurls1 Zhang San xh.jpg2 Li Si xh.jpg3 Wang Wu 3.jpg
Requirement: replace the xh in the urls field with the value of the id field
Statement:
UPDATE person SET urls = (REPLACE (urls,'xh',id))
Execution result:
Idnameurls1 Zhang San 1.jpg2 Li Si 2.jpg3 Wang Wu 3.jpg above is part of the data about how to replace a field in batch in Mysql shared by Xiaobian. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.