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. 【开发笔记】- 安装Git命令

    1.查看linux版本信息: $ cat /etc/redhat-release 2.输入命令安装git: $ yum install git 3.等待下载,自动安装完毕,查看git版本 $ git ...

  2. 折叠面板实现,上传文件进度条,三级联选择器,多级联选择器, 利用layui实现

    首先贴出html代码 <form class="layui-form" action=""> <div class="layui-f ...

  3. cpython多进程

    四 同步\异步and阻塞\非阻塞(重点) 同步: #所谓同步,就是在发出一个功能调用时,在没有得到结果之前,该调用就不会返回.按照这个定义,其实绝大多数函数都是同步调用.但是一般而言,我们在说同步.异 ...

  4. option触发及获取当前选中的option值

    #标签 #<select id="city" class="select"> #JavaScript #$("#city").c ...

  5. myEclipse项目部署点击Finish按钮没反应

    -- 问题描述:myEclipse项目部署点击Finish按钮没反应. -- 问题原因:Tomcat没有不熟JDK. -- 解决办法:window->preferences->servic ...

  6. ireport(1.2.7)的IllegalAccessError异常

    IllegalAccessError异常: Exception in thread "main" java.lang.IllegalAccessError: tried to ac ...

  7. 第五次博客作业——Alpha2项目的测试

    格式描述: 这个作业属于哪个课程 <课程的链接> 这个作业要求在哪里 <作业要求的链接> 团队名称 你的代码我的发 这个作业的目标 选取非自己所在团队的3个项目进行测试,并写出 ...

  8. appium+python自动化64-使用Uiautomator2执行driver.keyevent()方法报错解决

    前言 未加'automationName': 'Uiautomator2'参数使用Uiautomator可以正常使用driver.keyevent()方法,使用Uiautomator2时driver. ...

  9. 罗技k380在iOS下无法输入英文引号

    本来打算用iPad远程控制电脑主机进行编程的,但是在键盘回来之后开始试着用的时候发现没法输入英文状态的引号. 各种更换输入法都没有用.没有英文引号还写个锤子的代码. 解决办法:设置-通用-键盘,然后将 ...

  10. Echo团队Alpha冲刺 - 测试随笔

    目录 测试工作的安排 测试工具选择和运用 测试用例文档 测试体会 项目测试评述 测试工作的安排 模块 测试人 测试内容 单元测试 李东权,黄少勇 测试类或者函数是否能正确处理用户请求 接口测试 林弘杰 ...