使用正则表达式返回特定的MySQL字符串
让我们首先创建一个表-
mysql> create table DemoTable649 (Value text);
使用插入命令在表中插入一些记录-
mysql> insert into DemoTable649 values('1903');
mysql> insert into DemoTable649 values('9321010');
mysql> insert into DemoTable649 values('983032023393');
mysql> insert into DemoTable649 values('1234567892');
mysql> insert into DemoTable649 values('989898989');使用select语句显示表中的所有记录-
mysql> select *from DemoTable649;
这将产生以下输出-
+--------------+ | Value | +--------------+ | 1903 | | 9321010 | | 983032023393 | | 1234567892 | | 989898989 | +--------------+ 5 rows in set (0.00 sec)
以下是使用正则表达式返回特定MySQL字符串的查询-
mysql> select *from DemoTable649 where Value REGEXP '[0-9]{11}';这将产生以下输出-
+--------------+ | Value | +--------------+ | 983032023393 | +--------------+ 1 row in set (0.00 sec)
热门推荐
10 高一祝福语简短 励志
11 立秋节气简短祝福语
12 简短公司周年祝福语大全
13 中考感言简短祝福语大全
14 体育老师简短祝福语
15 干杯生日祝福语简短独特
16 特别简短的祝福语老师
17 朋友坐车走了祝福语简短
18 给英雄的祝福语简短