栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

MySQL可以替换多个字符吗?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

MySQL可以替换多个字符吗?

您可以链接REPLACe函数:

select replace(replace('hello world','world','earth'),'hello','hi')

这将打印

hi earth

您甚至可以使用子查询来替换多个字符串!

select replace(london_english,'hello','hi') as warwickshire_englishfrom (    select replace('hello world','world','earth') as london_english) sub

或使用JOIN替换它们:

select group_concat(newword separator ' ')from (    select 'hello' as oldword    union all    select 'world') originner join (    select 'hello' as oldword, 'hi' as newword    union all    select 'world', 'earth') trans on orig.oldword = trans.oldword

我将使用常见的表表达式来进行翻译,作为读者的练习;)



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/408165.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号