MySQL 判断某字段是否包含中文或字母字符的方法

方法一:正则表达式

select * from typg_house_tag where tht_num not REGEXP '(^[0-9]+.[0-9]+$)|(^[0-9]$)';
/*可能不准确*/

说明:

typg_house_tag :表名
tht_num :字段名

方法二:length() 和 char_length()

select * from typg_house_tag where LENGTH(tht_num) != CHAR_LENGTH(tht_num)

说明:

typg_house_tag :表名
tht_num :字段名

原文链接:https://www.cnblogs.com/Fooo/p/12427894.html

posted @ 2024-12-11 15:58  DAYTOY-105  阅读(774)  评论(0)    收藏  举报