温馨提示×

replace函数在mysql怎么使用

养鱼的猫咪
150
2021-03-18 09:59:01
栏目: 云计算
亿速云mysql数据库,读写分离,安全稳定,弹性扩容,低至0.3元/天!! 点击查看>>

replace函数在mysql怎么使用

replace函数作用:

mysql中replace函数的作用是对数据表中字段的字符进行替换。

replace函数语法:

update `table_name` SET `field_name` = replace (`field_name`,'old_str','new_str');

参数:

table_name:表示表的名称。

field_name:表示字段的名称。

old_str:需要替换的字符串。

new_str:需替换成的字符串。

replace函数使用方法:

例:将text表中id字段的python值替换为Java值

update `text` SET `id` = replace (`id`,'python','Java');

亿速云「云数据库 MySQL」免部署即开即用,比自行安装部署数据库高出1倍以上的性能,双节点冗余防止单节点故障,数据自动定期备份随时恢复。点击查看>>

推荐阅读:mysql的replace函数在事务中如何使用

0