Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How mysql replaces fields

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article focuses on "how to replace fields with mysql". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to replace fields with mysql.

In mysql, you can replace the field with the "UPDATE" statement and the REPLACE () function, with the syntax "UPDATE table name set field name = REPLACE (field name, 'content to be replaced', 'content to be replaced');".

The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.

Full replacement of MySql fields and partial replacement of fields

Syntax:

UPDATE table name set field name = REPLACE (field name, 'content to be replaced', 'replaced content')

It can also be written as:

UPDATE table name set field name = REPLACE (field name, fromStr,toStr)

(1) replace all

To replace all, send up what is to be replaced and what is to be replaced.

UPDATE user_bag SET cover_url = REPLACE (cover_url, 'http://static.zpnb.com/768.jpg','http://static.bddvip.com/zpnb412.png') WHERE id = 1

(2) partial replacement

For example, if I want to replace http://static.zpnb.com/768.jpg and http in the image path with https, I just need to fill in http, and https, and don't reverse the order.

UPDATE XXX SET item_example_img = REPLACE (item_example_img,'http','https') so far, I believe you have a deeper understanding of "how to replace fields with mysql". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report