mysql> select * from test;
+----+----------+-------+-----------+
| id | name | score | subject |
+----+----------+-------+-----------+
| | xiaoming | | shuxue |
| | xiaohong | | shuxue |
| | xiaohong | | english |
| | xiaohong | | physics |
| | xiaohong | | astronaut |
| | xiaoming | | physics |
| | xiaoming | | astronaut |
| | xiaoming | | english |
| | xiaobai | | astronaut |
| | xiaobai | | english |
| | xiaobai | | physics |
| | xiaobai | | shuxue |
| | xiaohei | | astronaut |
| | xiaohei | | shuxue |
| | xiaohei | | physics |
| | xiaohei | | english |
+----+----------+-------+-----------+
rows in set (0.00 sec) mysql> select * from test where name regexp "xiaohei";
+----+---------+-------+-----------+
| id | name | score | subject |
+----+---------+-------+-----------+
| | xiaohei | | astronaut |
| | xiaohei | | shuxue |
| | xiaohei | | physics |
| | xiaohei | | english |
+----+---------+-------+-----------+
rows in set (0.00 sec) mysql> select * from test where name regexp "hei";
+----+---------+-------+-----------+
| id | name | score | subject |
+----+---------+-------+-----------+
| | xiaohei | | astronaut |
| | xiaohei | | shuxue |
| | xiaohei | | physics |
| | xiaohei | | english |
+----+---------+-------+-----------+
rows in set (0.00 sec) mysql> select * from test where name regexp ".hei";
+----+---------+-------+-----------+
| id | name | score | subject |
+----+---------+-------+-----------+
| | xiaohei | | astronaut |
| | xiaohei | | shuxue |
| | xiaohei | | physics |
| | xiaohei | | english |
+----+---------+-------+-----------+
rows in set (0.00 sec) mysql> select * from test where name regexp ".he";
+----+---------+-------+-----------+
| id | name | score | subject |
+----+---------+-------+-----------+
| | xiaohei | | astronaut |
| | xiaohei | | shuxue |
| | xiaohei | | physics |
| | xiaohei | | english |
+----+---------+-------+-----------+
rows in set (0.00 sec) mysql> select * from test where name regexp "hei";
+----+---------+-------+-----------+
| id | name | score | subject |
+----+---------+-------+-----------+
| | xiaohei | | astronaut |
| | xiaohei | | shuxue |
| | xiaohei | | physics |
| | xiaohei | | english |
+----+---------+-------+-----------+
rows in set (0.00 sec) mysql> select * from test where name regexp "hei|bai";
+----+---------+-------+-----------+
| id | name | score | subject |
+----+---------+-------+-----------+
| | xiaobai | | astronaut |
| | xiaobai | | english |
| | xiaobai | | physics |
| | xiaobai | | shuxue |
| | xiaohei | | astronaut |
| | xiaohei | | shuxue |
| | xiaohei | | physics |
| | xiaohei | | english |
+----+---------+-------+-----------+
rows in set (0.00 sec)
mysql> select * from test;
+----+------------+-------+-----------+
| id | name | score | subject |
+----+------------+-------+-----------+
| | xiaoming | | shuxue |
| | xiaohong | | shuxue |
| | xiaohong | | english |
| | xiaohong | | physics |
| | xiaohong | | astronaut |
| | xiaoming | | physics |
| | xiaoming | | astronaut |
| | xiaoming | | english |
| | xiaobai | | astronaut |
| | .2xiaobai | | english |
| | .2xiaobai | | physics |
| | 3xiaobai | | shuxue |
| | 123xiaohei | | astronaut |
| | xiaohei | | shuxue |
| | xiaohei | | physics |
| | xiaohei | | english |
+----+------------+-------+-----------+
rows in set (0.00 sec) mysql> update test set name="123xiaohei" where id=;
Query OK, row affected (0.01 sec)
Rows matched: Changed: Warnings: mysql> select * from test where name regexp '[[:digit:]]{3}';
+----+------------+-------+-----------+
| id | name | score | subject |
+----+------------+-------+-----------+
| | 123xiaohei | | astronaut |
+----+------------+-------+-----------+
row in set (0.00 sec) mysql> select * from test where name regexp "^xiao";
+----+----------+-------+-----------+
| id | name | score | subject |
+----+----------+-------+-----------+
| | xiaoming | | shuxue |
| | xiaohong | | shuxue |
| | xiaohong | | english |
| | xiaohong | | physics |
| | xiaohong | | astronaut |
| | xiaoming | | physics |
| | xiaoming | | astronaut |
| | xiaoming | | english |
| | xiaobai | | astronaut |
| | xiaohei | | shuxue |
| | xiaohei | | physics |
| | xiaohei | | english |
+----+----------+-------+-----------+
rows in set (0.00 sec) mysql> update test set name=".12xiaohei" where id=;
Query OK, row affected (0.00 sec)
Rows matched: Changed: Warnings: mysql> select * from test;
+----+------------+-------+-----------+
| id | name | score | subject |
+----+------------+-------+-----------+
| | xiaoming | | shuxue |
| | xiaohong | | shuxue |
| | xiaohong | | english |
| | xiaohong | | physics |
| | xiaohong | | astronaut |
| | xiaoming | | physics |
| | xiaoming | | astronaut |
| | xiaoming | | english |
| | xiaobai | | astronaut |
| | .2xiaobai | | english |
| | .2xiaobai | | physics |
| | 3xiaobai | | shuxue |
| | 123xiaohei | | astronaut |
| | xiaohei | | shuxue |
| | xiaohei | | physics |
| | .12xiaohei | | english |
+----+------------+-------+-----------+
rows in set (0.00 sec) mysql> select * from test where name regexp "[[:digit:]\\.]";
+----+------------+-------+-----------+
| id | name | score | subject |
+----+------------+-------+-----------+
| | .2xiaobai | | english |
| | .2xiaobai | | physics |
| | 3xiaobai | | shuxue |
| | 123xiaohei | | astronaut |
| | .12xiaohei | | english |
+----+------------+-------+-----------+
rows in set (0.00 sec) mysql> select * from test where name regexp "^[[:digit:]\\.]";
+----+------------+-------+-----------+
| id | name | score | subject |
+----+------------+-------+-----------+
| | .2xiaobai | | english |
| | .2xiaobai | | physics |
| | 3xiaobai | | shuxue |
| | 123xiaohei | | astronaut |
| | .12xiaohei | | english |
+----+------------+-------+-----------+
rows in set (0.00 sec)

mysql regexp 表达式的更多相关文章

  1. 测量MySQL的表达式和函数的速度

    测量MySQL的表达式和函数的速度,可以调用benchmark()函数.语法格式是benchmark(loop_count,expr).运行的返回值是0,但是mysql会打印一行显示语句大概要执行多长 ...

  2. mysql regexp用法

    正则表达式作用是匹配方本,将一个模式(正则表达式)与一个文本串进行比较. MySQL用WHERE子句对正则表达式提供了初步的支持,允许你指定用正则表达式过滤SELECT检索出的数据. MySQL仅支持 ...

  3. MySQL where 表达式

    where 条件表达式 对记录进行过滤,如果没有指定where子句,则显示所有记录. 在where表达式中,可以使用MySQL支持的函数或运算符.

  4. MySQL SELECT表达式的执行顺序是从左往右依次执行

    例子如下:(确保这几个变量都是初次使用,因为mysql的用户自定义变量会在整个连接session中存在) ,,; +--------+-------+---------+-------+ | +--- ...

  5. mysql查询表达式解析

    1.mysql> SHOW COLUMNS FROM users;+----------+----------------------+------+-----+---------+------ ...

  6. MySQL中REGEXP正则表达式使用大全

    REGEXP在mysql是用来执行正则表达式的一个函数 像php中的preg之类的函数了,regexp正则函数如果只是简单的查询使用like即可,但复杂的还是需要使用regexp了,下面我们来看看. ...

  7. Thinkphp用exp表达式执行mysql语句,查询某字段不为空is not null,自动增值

    Thinkphp用exp表达式执行mysql语句,查询某字段不为空is not null,自动增值 Thinkphp 的文档经常不够完整的表达MYSQL的各种组合,is not null在thinkp ...

  8. Thinkphp中查询复杂sql查询表达式,如何表达MYSQL中的某字段不为空is not null?

    Thinkphp中查询复杂sql查询表达式,如何表达MYSQL中的某字段不为空is not null?先上两种实现方式的实例:$querys["house_type_image"] ...

  9. mysql 函数编程大全(持续更新)

    insert ignore insert ignore表示,如果中已经存在相同的记录,则忽略当前新数据 如果您使用一个例如“SET col_name = col_name + 1”的赋值,则对位于右侧 ...

随机推荐

  1. Windows下使用MongoDb的经验

    随着NoSql广泛应用MongoDb这个Json数据库现在也被广泛使用,接下来简单介绍一下Windows下如使安装使用MongoDb. 一.安装MongoDb 1.首先去官方网址:(https://w ...

  2. js调用浏览器下载

    $scope.Download = function (url) { var save_link = document.createElementNS("http://www.w3.org/ ...

  3. HTTP协议的认识

    1.内容回顾 1.HTTP协议消息的格式: 1.请求(request) 请求方法 路径 HTTP/1.1 \r\n k1:v1\r\n ...\r\n \r\n 请求体 <--这里可以有可以没有 ...

  4. Python基础知识(五)------字典

    Python基础知识(四)------字典 字典 一丶什么是字典 ​ dict关键字 , 以 {} 表示, 以key:value形式保存数据 ,每个逗号分隔 ​ 键: 必须是可哈希,(不可变的数据类型 ...

  5. 【故障处理】 DBCA建库报错CRS-2566

    [故障处理] DBCA建库报错CRS-2566 PRCR-1071 PRCR-1006 一.1  BLOG文档结构图       一.2  前言部分   一.2.1  导读和注意事项 各位技术爱好者, ...

  6. selenium三个等待方法

    为什么需要等待时间:页面加载需要时间,如果页面没有加载完成,直接去定位,可能定位不到元素 1.强制等待: import time time.sleep(2) 不管有没有完成加载,必须等待2秒 2.隐式 ...

  7. React: 无状态组件生成真实DOM结点

    在上一篇文章中,我们总结并模拟了 JSX 生成真实 DOM 结点的过程,今天接着来介绍一下无状态组件的生成过程. 先以下面一段简单的代码举例: const Greeting = function ({ ...

  8. Kubernetes pod平滑迁移

    pod平滑迁移 使用到的命令 (cordon, drain, uncordon)这三个命令是正式release的1.2新加入的命令,三个命令一起介绍,是因为三个命令配合使用可以实现节点的维护.在1.2 ...

  9. Python的路径操作(os模块与pathlib模块)

    Python的路径操作(os模块与pathlib模块) 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.os.path模块(Python 3.4版本之前推荐使用该模块) #!/u ...

  10. 介于JAVAswing和Socket写的聊天室

    在厦门的第一阶段给我们复习了JAVASE基础,第一阶段的小玩具叫我们自选题材,我自己选了聊天室这个内容,这个小玩具无论是线程,还是网络编程,都会涉及到,比较有综合性,所以我选了这个: 这是我的包体结构 ...