-- 脱敏姓名 UPDATE wb_person_message SET `name`=(if(LENGTH(name)>6,CONCAT(LEFT(name,1), '**' ),CONCAT(LEFT(name,1), '*' ))); -- 脱敏身份证号 UPDATE wb_person_message SET idNumber=CONCAT(LEFT(idNumber,4), '************' ,RIGHT(idNumber,2)); -- 脱敏学历 update wb_person_message set education = '博士',university = '清华大学',specialities='计算机科学与技术'; -- 脱敏手机号 UPDATE wb_person_message set phone = CONCAT(LEFT(phone,3), '*****' ,RIGHT(phone,3)); -- 查询结果 SELECT name,idNumber,phone,education,university,specialities from wb_person_message;
处理之后字段信息如下: