MySQL比like语句更高效的写法locate position instr find_in_set
来源:互联网 发布:php curl http post 编辑:程序博客网 时间:2024/04/30 04:37
你是否一直在寻找比MySQL的LIKE语句更高效的方法的,下面我就为你介绍几种。
LIKE语句
SELECT `column` FROM `table` where `condition` like `%keyword%'
事实上,可以使用 locate(position) 和 instr 这两个函数来代替
一、LOCATE语句
SELECT `column` from `table` where locate(‘keyword’, `condition`)>0
二、或是 locate 的別名 position
POSITION语句
SELECT `column` from `table` where position(‘keyword’ IN `condition`)
三、INSTR语句
SELECT `column` from `table` where instr(`condition`, ‘keyword’ )>0
locate、position 和 instr 的差別只是参数的位置不同,同时locate 多一个起始位置的参数外,两者是一样的。
mysql> SELECT LOCATE(‘bar’, ‘foobarbar’,5);
-> 7
速度上这三个比用 like 稍快了一点。
阅读全文
0 0
- MySQL中比like语句更高效的写法locate position instr find_in_set
- MySQL中比like语句更高效的写法locate position instr find_in_set
- MySQL中比like语句更高效的写法locate position instr find_in_set
- MySQL比like语句更高效的写法locate position instr find_in_set
- MySQL比like语句更高效的写法locate position instr find_in_set
- MySQL比like语句更高效的写法locate position instr find_in_set
- MySQL中比like语句更高效的写法locate/position/instr/find_in_set
- MySQL比like语句更高效的写法locate、position、instr find_in_set
- MySQL比like语句更高效的写法locate position instr find_in_set
- MySQL:比like语句更高效的写法locate position instr find_in_set(2014-05-07 17:40:04)
- mysql 模糊查询语句比较(LIKE、instr、locate、find_in_set、position)
- MySQL比like语句更高效的写法
- mysql中比like更高效的查询find_in_set
- 谈一谈MySQL的LOCATE、FIND_IN_SET、INSTR、POSITION的差别
- SQL之查询函数LOCATE、POSITION、INSTR、FIND_IN_SET、IN、LIKE
- Mysql函数INSTR、LOCATE、POSITION VS LIKE
- Mysql函数INSTR、LOCATE、POSITION VS LIKE
- Mysql函数INSTR、LOCATE、POSITION VS LIKE
- ubantu16.04配置caffe
- 求一个集合的所有子集
- css和css3属性的兼容性
- ok3 日志 session问题
- CAS4.0.x server 集成微信扫码登录和Oauth2登录
- MySQL比like语句更高效的写法locate position instr find_in_set
- Spark Streaming 流计算优化记录(2)-不同时间片数据流的Join
- [技术人生]在你步入职业软件开发生涯那天起就该知道的五件事
- Windows文件换行符转Linux换行符
- Anbox 容器管理服务
- 数组
- fastjson SerializerFeature详解
- PHPMailer发送邮件中的坑
- servlet中请求转发(forward)与重定向(sendredirect)的区别