比如车牌 晋A12345 中的 晋 字。有的行是没有的,只要删除有的
sql语句:
-- Oracle
update
表
set
列 =
replace
(列,
'晋'
,
''
)
where
列
like
'%晋%'
or
update
表
set
列 =
'晋'
|| 列
where
列
not
like
'%晋%'
-- MySQL
update
表
set
列 =
replace
(列,
'晋'
,
''
)
where
列
like
'%晋%'
or
update
表
set
列 = CONCAT(
'晋'
,列)
where
列
not
like
'%晋%'
-- SQLServer
update
表
set
列 =
replace
(列,
'晋'
,
''
)
where
列
like
'%晋%'
or
update
表
set
列 =
'晋'
+列
where
列
not
like
'%晋%'

本文介绍如何使用Oracle、MySQL及SQL Server等数据库系统的SQL语句进行字符串操作,包括删除特定字符及在条件不满足时添加特定字符。示例以车牌号中“晋”字的处理为背景。
1573

被折叠的 条评论
为什么被折叠?



