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