MySQL 替换字符串:REPLACE() 函数使用指南
在 MySQL 中,可以使用 REPLACE() 函数来替换字符串。
语法如下:
REPLACE(str, 'old_string', 'new_string')
其中,str 是要替换的字符串,'old_string' 是要被替换的子字符串,'new_string' 是要替换成的新字符串。
示例:
将字符串 'Hello World!' 中的 'World' 替换为 'MySQL':
SELECT REPLACE('Hello World!', 'World', 'MySQL');
输出结果为: 'Hello MySQL!'
原文地址: https://www.cveoy.top/t/topic/mq3N 著作权归作者所有。请勿转载和采集!