当前位置:网站首页>MySQL模糊查询可以使用INSTR替代LIKE
MySQL模糊查询可以使用INSTR替代LIKE
2022-07-31 04:10:00 【滴水可藏海】
NSTR()函数返回字符串中子字符串第一次出现的位置。如果在str中找不到子字符串,则INSTR()函数返回零(0)。
下面说明了INSTR函数的语法。
INSTR(str,substr);INSTR函数接受两个参数:
str 是要搜索的字符串。
substr 是要搜索的子字符串。
MySQL INSTR函数示例
以下语句返回MySQL INSTR字符串中的子字符串SQL的位置。
SELECT INSTR('MySQL INSTR', 'SQL');执行上面查询语句,得到以下结果:
mysql> SELECT INSTR('MySQL INSTR', 'SQL');
+-----------------------------+
| INSTR('MySQL INSTR', 'SQL') |
+-----------------------------+
| 3 |
+-----------------------------+
1 row in set例2
SELECT * FROM sys_user where INSTR(name, 'a' )>0查找用户名称name中包含a的用户,作用类似于LIKE ‘%a%’。
发现其他博客(非作者所写):
Mysql的instr()函数用法
边栏推荐
猜你喜欢

type_traits元编程库学习

LeetCode每日一练 —— OR36 链表的回文结构

The third is the code to achieve

Daily practice of LeetCode - palindrome structure of OR36 linked list

高等数学---第九章二重积分
![[C language] General method of base conversion](/img/28/954af5f47a79ff02d3cc0792ac8586.jpg)
[C language] General method of base conversion

What is a system?

No qualifying bean of type question

扫雷游戏(c语言写)

Regarding the primary key id in the mysql8.0 database, when the id is inserted using replace to be 0, the actual id is automatically incremented after insertion, resulting in the solution to the repea
随机推荐
[Paper reading] Mastering the game of Go with deep neural networks and tree search
慧通编程第4关 - 魔法学院第6课
Postgresql 15 source code analysis (5) - pg_control
idea工程明明有依赖但是文件就是显示没有,Cannot resolve symbol ‘XXX‘
端口排查步骤-7680端口分析-Dosvc服务
$parent/$children 与 ref
Bubble sort, selection sort, insertion sort, binary search directly
三子棋的代码实现
MySQL 8.0.30 GA
MATLAB/Simulink & & STM32CubeMX tool chain completes model-based design development (MBD) (three)
A brief introduction to the showDatePicker method of the basic components of Flutter
[Swift]自定义点击APP图标弹出的快捷方式
qlib自动化quant
Difference between unallocated blocks and unused blocks in database files
"A daily practice, happy water problem" 1331. Array serial number conversion
type_traits metaprogramming library learning
binom二项分布,
addressable in Golang
(4) Recursion, variable parameters, access modifiers, understanding main method, code block
Why don't you programmers make a living off your own projects?And have to work for someone else?