Java OpenResty Spring Spring Boot MySQL Redis MongoDB PostgreSQL Linux Android Nginx 面试 小程序 Arthas JVM AQS juc Kubernetes Docker 诊断工具


MySQL/Oracle 更新或替换字符串字段中的部分内容

MySQL Oracle 大约 272 字

语法

UPDATE `table_name` SET `field_name` = REPLACE(`field_name`, 'from_str', 'to_str') WHERE `field_name` LIKE '%from_str%';

案例

去除字符串中的url链接

UPDATE `URL_LINK` set `content` = REPLACE(`content`, 'http://www.zhangbj.com/','') where `content` LIKE '%http://www.zhangbj.com/%'
阅读 2945 · 发布于 2020-01-14

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb

扫描下方二维码关注公众号和小程序↓↓↓

扫描二维码关注我
昵称:
随便看看 换一批