MySQL通配符过滤数据
来源:互联网 发布:刷单平台 php源码 编辑:程序博客网 时间:2024/05/21 12:47
LIKE操作符
百分号(%)通配符
mysql> select * from user where name like '%3';+----+-------+| id | name |+----+-------+| 3 | user3 |+----+-------+1 row in set (0.00 sec)
mysql> select * from user where name like 'user%';+----+-------+| id | name |+----+-------+| 1 | user1 || 2 | user2 || 3 | user3 || 4 | user4 || 5 | user5 |+----+-------+5 rows in set (0.00 sec)
mysql> select * from user where name like '%er%';+----+-------+| id | name |+----+-------+| 1 | user1 || 2 | user2 || 3 | user3 || 4 | user4 || 5 | user5 |+----+-------+5 rows in set (0.00 sec)//不能用'%'来代替NULL。
下划线(_)通配符
mysql> select * from user where name like 'user_';+----+-------+| id | name |+----+-------+| 1 | user1 || 2 | user2 || 3 | user3 || 4 | user4 || 5 | user5 |+----+-------+5 rows in set (0.00 sec)
mysql> select * from user where name like '_ser_';+----+-------+| id | name |+----+-------+| 1 | user1 || 2 | user2 || 3 | user3 || 4 | user4 || 5 | user5 |+----+-------+5 rows in set (0.00 sec)
mysql> select * from content where tittle like '_ello%';+------+--------------+| uid | tittle |+------+--------------+| 0 | Hello World! |+------+--------------+79 rows in set (0.00 sec)
通配符使用技巧
- 不要过度使用通配符
- 通配符尽量不要放在搜索模式的开头,否则会很慢。
- 要注意通配符的位置。
阅读全文
0 0
- MySQL通配符过滤数据
- MySQL数据过滤和通配符过滤.md
- mysql过滤数据(三)用通配符进行过滤
- Mysql必知必会(笔记)【高级数据过滤、通配符进行过滤】
- MySQL--操作简记(where过滤,通配符过滤数据)
- MySQL通配符过滤
- MySQL 用通配符过滤
- MySQL检索数据(过滤+通配符+正则表达式)
- MySQL用通配符进行过滤
- MySql通配符过滤,正则表达式过滤.
- MySQL学习足迹记录06--数据过滤--LIKE搭配百分号(%)和下划线(_)通配符
- MySQL数据库——用通配符和正则表达式过滤数据(一)
- MySQL数据库——用通配符和正则表达式过滤数据(二)
- MySQL必知必会-7用通配符进行过滤
- [MYSQL-8]用通配符进行过滤
- SQL 3.高级数据过滤 - 1 通配符过滤
- MySQL过滤数据
- mysql的过滤数据
- php不输出错误信息解决办法
- Android Service的生命周期
- 关于websocket的学习两个Demo
- Android用户界面_布局
- VC进制转换(二进制-十进制-十六进制)
- MySQL通配符过滤数据
- mybatis增删改
- android热修复平台架构方案
- oracle 还原数据库 imp
- AFNetWorking
- 多线程编程10例问题(3)
- ERROR server: 192.168.20.175:22122, response status 2 != 0
- Java.lang.IllegalArgumentException: You need to use a Theme.AppCompat theme (or descendant) with the
- Python_两种导入模块的方法异同