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 如何训练狗狗不叫
2 训练狗狗不叫
3 训练狗狗随行
4 怎么训练狗狗不叫
7 训练比熊狗狗教程
10 上海狗狗训练
11 怎么训练狗狗上厕所
12 训练狗狗趴下
13 狗狗服从训练
14 训练狗狗拒食
15 训练狗狗笑
16 训练狗狗大便
17 训练狗狗立
18 训练狗狗捡东西