SQL 姓名,联系方式-脱敏



SELECT
ORDER_PROJECT.project_type AS attribute, ORDER_PROJECT.order_num, REPLACE(CUSTOMER.cust_name,SUBSTR(CUSTOMER.cust_name,2,1), "*") AS pv, CUSTOMER.province AS area, REPLACE(CUSTOMER.mobile,SUBSTR(CUSTOMER.mobile,4,4), "****") AS mobile0 FROM ORDER_PROJECT, CUSTOMER, ORDER_LOG ORDER BY ORDER_PROJECT.id DESC LIMIT 10;

 

 

 

0.姓名脱敏,对姓名第二个字用*进行替换。spa

  实现状况如图所示,code

 SQL:blog

SELECT    REPLACE(cust_name,SUBSTR(cust_name,2,1), "*")     AS name from ‘表名’;class

1.联系方式脱敏,对联系电话中间四位用*进行替换。mobile

  实现状况如图所示:im

SQL:img

SELECT    REPLACE(mobile,SUBSTR(mobile,2,1), "*")     AS name from ‘表名’;di

 

该方式存在问题:vi

  该方式是利用取截取的字段,匹配字符,若名字为王大大,则会匹配成王**,联系方式同理。co

相关文章
相关标签/搜索