版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/XiaoXiao_RenHe/article/details/80902694
1、替换函数replace(colum,str1,str2)
replace,指将colum字段中的str1字符串替换为str2字符串
如:update v_cus_customer set phone=replace(phone,'8','*');
将phone字段中的数字8,替换为*
2、截取left(colum,n)、right(colum,n)及拼接函数concat_ws('-',str1,str2,str3,....)
left,指将colum字段从左边截取n个字符
right,指将colum字段从右边截取n个字符
concat_ws,指按照‘-’将str1、str2、str3...等字符串拼接在一起
如:update v_cus_customer set phone=concat_ws('',left(phone,3),'****',right(phone,4));
将phone字段中间4位修改为*
如18192376666-------》181****6666
3、字段长度函数length(colum)
length,获取字段colum的长度
如:select phone from v_cus_customer where length(phone)<11;
获取号码长度小于11的电话号码