mysql更改字符串长度_如何在MySQL表中更改字符串

mysql更改字符串长度

How to change strings in MySQL tables? e.g. I want to change domain.com to www.domain.com.

如何更改MySQL表中的字符串? 例如,我想将domain.com更改为www.domain.com。

Use the REPLACE functions of MySQL: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace

使用MySQL的REPLACE函数: http : //dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace

One example is like this:

一个例子是这样的:

UPDATE table
SET field = REPLACE(field, 'domain.com', 'www.domain.com')
WHERE field LIKE '%domain.com%'

The WHERE clause is not needed but can make execution faster.

WHERE子句不是必需的,但可以使执行速度更快

Answered by anonymous.
匿名回答。

翻译自: https://www.systutorials.com/how-to-change-strings-in-mysql-tables/

mysql更改字符串长度