SQL accumulation -- replace the specified content in the specified field data _ MySQL

Source: Internet
Author: User
SQL accumulation -- replace the specified content in the specified field data this time this request: The Image connection in the database was previously a small image. to replace it with a graph, I started to search it out with java code and traverse the list, replace the character in the modified image connection. As there are more than 2 million data records, it is a problem to query them one by one (0-2000,-,...) in turn, which is also troublesome. If you want to re-import the data, you need to import the image URL of the required size. later, you want to use the function provided by mysql to process REPLACE (filed, 'regex', 'str ') it is equivalent to the replace in java. it only specifies the replaced Field filed.

There are three types of images:

Large: http://media.digikey.com/Photos/Skyworks%20Solutions%20Photos/SE2564L-R_tmb.jpg

Medium: http://media.digikey.com/Photos/Skyworks%20Solutions%20Photos/SE2564L-R_sml.jpg

Small: http://media.digikey.com/Photos/Skyworks%20Solutions%20Photos/SE2564L-R_tmb.jpg

Due to regularity, it is easy to replace.

UPDATE t_product_copy tpc
SET tpc. img = REPLACE (img, '_ tmb', '_ sml ')

Execution result: (This field has a lot of data that is blank and is not modified)

[SQL] UPDATEt_product_copy tpc

SET tpc. img = REPLACE (img, '_ tmb', '_ sml ')

Affected rows: 1153979
Date: 41.572 ms

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.