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. MVC学习笔记(四)---使用linq多表联查(SQL)

    1.数据库原型(Students表中的ID和Scores表中的StudentID是对应的) 2.实现效果:查询出每个学生各个科目的成绩(用的是MVC学习笔记(三)—用EF向数据库中添加数据的架构) C ...

  2. Entity Framework Codefirst的配置步骤

    Entity Framework Codefirst的配置步骤: (1) 安装命令: install-package entityframework (2) 创建实体类,注意virtual关键字在导航 ...

  3. 如何定位 golang 进程 hang 死的 bug

    之前在 golang 群里有人问过为什么程序会莫名其妙的 hang 死然后不再响应任何请求.单核 cpu 打满. 这个特征和我们公司的某个系统曾经遇到的情况很相似,内部经过了很长时间的定位分析总结,期 ...

  4. DEDECMS文章标题显示不全的原因以及解决方法

    首先这里说一下编码问题:UTF-8与GBK(通常为GB2312). GBK是在国家标准GB2312基础上扩容后兼容GB2312的标准(好像还不是国家标准):GBK编码专门用来解决中文编码的,是双字节的 ...

  5. spring boot 集成 sitemesh

    一.Sitemesh简介 Sitemesh是由一个基于Web页面布局.装饰及与现存Web应用整合的框架,是一个装饰器.它能帮助我们在由大量页面工程的项目中创建一致的页面布局和外观,如一致的导航条.一致 ...

  6. Combox控件绑定大量数据卡顿问题与解决办法

    一般我们WPF中Combox的绑定都是下面这种写法. XAML: <ComboBox IsEditable="False" ItemsSource="{Bindin ...

  7. oracle 如何预估将要创建的索引的大小

    一.1  oracle 如何预估将要创建的索引的大小 oracle 提供了2种可以预估将要创建的索引大小的办法: ①  利用包 Dbms_space.create_index_cost 直接得到 ②  ...

  8. QtCreator设置野火iMx6开发板提供的qt交叉编译套件

    在Ubuntu18 QtCreator上添加野火iMx6开发板的Qt交叉编译环境PC:Ubuntu18.04QtCreator: 4.8.2交叉编译环境:野火提供的 5-编译工具链->qt交叉编 ...

  9. uuid简述

    什么是UUID? UUID是Universally Unique Identifier的缩写,它是在一定的范围内(从特定的名字空间到全球)唯一的机器生成的标识符,参考RFC规范-RFC4122. UU ...

  10. vue 使用moment

    1.下载 cnpm i moment --save 2.main.js  挂载 import moment from 'moment'//导入文件 Vue.prototype.$moment = mo ...