MySQL中比like语句更高效的写法locate/position/instr/find_in_set
来源:互联网 发布:网红美图软件有哪些 编辑:程序博客网 时间:2024/04/30 05:09
1、LIKE
SELECT `column` FROM `table` where `condition` like`%keyword%'
事实上,可以使用 locate(position) 和 instr这两个函数来代替
2、LOCATE语句
SELECT `column` from `table` where locate(‘keyword’,`condition`)>0
3、POSITION语句(LOCATE 的別名 POSITION)
SELECT `column` from `table` where position('keyword' IN `condition`)
4、INSTR语句
SELECT `column` from `table` where instr(`condition`,'keyword')>0
locate、position 和 instr 的差別只是参数的位置不同,同时locate多一个起始位置的参数外,两者是一样的。
mysql> SELECT `column` from `table` where LOCATE(‘bar’, ‘foobarbar’,5);
5、FIND_IN_SET语句
find_in_set(str1,str2) 函数:返回str2中str1所在的位置索引,其中str2必须以","分割开。
mysql> select * from test where find_in_set('name1',name);
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更高效的查询find_in_set
- mysql 模糊查询语句比较(LIKE、instr、locate、find_in_set、position)
- MySQL比like语句更高效的写法
- 谈一谈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
- 使用main函数的参数,实现一个整数计算器,程序可以接受三个参数,第一个参数“-a”选项执行加法,“-s”选项执行减法,“-m”选项执行乘法,“-d”选项执行除法,后面两个参数为操作数。
- 类模板遇到友元函数模板
- servlet的作用到底是什么?最直接的理解
- Linux下用户组、文件权限详解
- Visitor模式
- MySQL中比like语句更高效的写法locate/position/instr/find_in_set
- Codeforces300D Painting Square
- java集合总结
- 自定义的layout(实训)
- 剑指offer——求1+2+3+...+n______
- 常用网络工具
- 自定义AdapterView的空视图
- AJAX相关变量&参数小解
- Code Review:C#与JAVA的哈希表内部机制的一些区别