文章詳情頁
mysql 查詢身份證號字段值有效的數據
瀏覽:131日期:2022-06-13 09:39:06
問題描述
表中身份證號字段中的值有的是無效的,怎么查詢出身份證號填寫有效的信息?謝謝
問題解答
回答1:正則表達式:
身份證的正則:d{6}(18|19|20)d{2}(0[1-9]|1[120])(0[1-9]|[12]d|3[01])d{3}(d|X)mysql下的正則:
select * from table where identity regexp ’[[:digit:]]{6}(18|19|20)[[:digit:]]{2}(0[1-9]|1[120])(0[1-9]|[12][[:digit:]]|3[01])[[:digit:]]{3}([[:digit:]]|X)’回答2:
select * from 表 where list regexp ’^[0-9]{18}$’
相關文章:
1. mysql - AttributeError: ’module’ object has no attribute ’MatchType’2. github - 利用Python 自動化部署問題3. 求大神幫我看看是哪里寫錯了 感謝細心解答4. npm鏡像站全新上線5. javascript - 圖片能在網站顯示,但控制臺仍舊報錯403 (Forbidden)6. python - from ..xxxx import xxxx到底是什么意思呢?7. php自學從哪里開始?8. MySQL客戶端吃掉了SQL注解?9. phpstady在win10上運行10. 數據庫 - MySQL 單表500W+數據,查詢超時,如何優化呢?
排行榜
