mysql⾝份证号的类型_MySQL--隐藏⼿机号、⾝份证号三种⽅
式
测试数据
SELECT
*
FROM
`userinfo`;
⽅式⼀(最推荐)
SELECT
`name` AS '姓名',
ISERT ( telephone, 4, 4, '****' ) AS '⼿机号',
ISERT ( cardID, 4, 11, '***********' ) AS '⾝份证号'
FROM
userinfo;
⽅式⼆
SELECT
`name` AS '姓名',
REPLACE ( telephone, SUBSTR( telephone, 4, 4 ), '****' ) AS '⼿机号',
REPLACE ( cardID, SUBSTR( cardID, 4, 11 ), '***********' ) AS '⾝份证号'
FROM
userinfo;
⽅式三
SELECT
`name` AS '姓名',
COCAT_WS( '', SUBSTR( telephone, 1, 3 ), '****', SUBSTR( telephone, 8, 4 ) ) AS '⼿机号',
COCAT_WS( '', SUBSTR( cardID, 1, 3 ), '***********', SUBSTR( cardID, 15, 4 ) ) AS '⾝份证号'
FROM
userinfo;
本文发布于:2023-05-25 09:03:03,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/falv/fa/86/110584.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |