SQL更新并替换子字符串 [英] SQL Update and replace substring

查看:178
本文介绍了SQL更新并替换子字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个SQL查询,该查询将名称表中first_name列中的所有字符串"a"更改为"b". 这是我的栏名称: first_name | list_name

I want a query in SQL that change all 'a' in string to 'b' in first_name column in name table. Here is my columns name: first_name | list_name

推荐答案

使用REPLACE()

UPDATE tableName
SET first_name = REPLACE(first_name, 'a', 'b')

但请记住,REPLACE()区分大小写.

but remember that REPLACE() is case sensitive.

这篇关于SQL更新并替换子字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆