MySQL regexp只显示带有字符串或带有数字的字符串的记录。只忽略号码记录
为此,您可以使用REGEXP。以下是语法-
select yourColumnName from yourTableName where yourColumnName REGEXP '[a−zA&minu;Z]';
让我们创建一个表-
mysql> create table demo41 −> ( −> name varchar(40) −> );
借助insert命令将一些记录插入表中-
mysql> insert into demo41 values('John Smith34')
−> ;
mysql> insert into demo41 values('John Smith');
mysql> insert into demo41 values('9234John Smith');
mysql> insert into demo41 values('john smith');
mysql> insert into demo41 values('98775');使用select语句显示表中的记录-
mysql> select *from demo41;
这将产生以下输出-
+----------------+ | name | +----------------+ | John Smith34 | | John Smith | | 9234John Smith | | john smith | | 98775 | +----------------+ 5 rows in set (0.00 sec)
以下是对MySQLregexp的查询-
mysql> select name from demo41 where name REGEXP '[a−zA−Z]';
这将产生以下输出-
+----------------+ | name | +----------------+ | John Smith34 | | John Smith | | 9234John Smith | | john smith | +----------------+ 4 rows in set (0.00 sec)
热门推荐
1 如何训练狗狗握手
10 新员工寄语祝福语简短
11 新婚敬酒祝福语大全简短
12 怎么训练狗狗
13 训练狗狗上厕所
14 春蚕老师祝福语简短励志
15 高考好运如愿祝福语简短
16 战哥过年祝福语简短
17 中考感谢朋友祝福语简短
18 长沙旅游祝福语大全简短