使用REPLACE()函数,REPLACE(string, from_string, new_string)
string 必须项。原始字符串
from_string 必须项。要替换的子字符串
new_string 必须项。新的替换子字符串
SELECT REPLACE('aaa.mysql.com','a','w');
www.mysql.com
由运行结果可以看出,使用 REPLACE('aaa.mysql.com','a','w') 将“aaa.mysql.com”字符串的“a”字符替换为“w”字符,结果为“www.mysql.com”。
UPDATE name
SET path = REPLACE (
name,
'http://www.baidu.com/',
'http://111.baidu.com'
)