当前位置:网站首页>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()函数用法
边栏推荐
- 强化学习:从入门到入坑再到拉屎
- Redis uses LIST to cache the latest comments
- A brief introduction to the CheckBox component of the basic components of Flutter
- 从滴滴罚款后数据治理思考
- 【AUTOSAR-RTE】-4-Port和Interface以及Data Type
- MySQL基础操作
- C语言从入门到如土——数据的存储
- Mysql 45 study notes (23) How does MYSQL ensure that data is not lost
- (8) Math class, Arrays class, System class, Biglnteger and BigDecimal classes, date class
- Mysql 45 study notes (twenty-four) MYSQL master-slave consistency
猜你喜欢
The application and practice of mid-to-platform brand advertising platform
Detailed explanation of TCP and UDP
VS QT - ui does not display newly added members (controls) || code is silent
Why don't you programmers make a living off your own projects?And have to work for someone else?
Postgresql 15 source code analysis (5) - pg_control
Just debuted "Fight to Fame", safety and comfort are not lost
(8) Math class, Arrays class, System class, Biglnteger and BigDecimal classes, date class
Zotero如何删除自动生成的标签
C语言从入门到如土——数据的存储
IIR filter and FIR filter
随机推荐
安全20220712
【SemiDrive源码分析】【MailBox核间通信】44 - 基于Mailbox IPCC RPC 实现核间通信(RTOS侧 IPCC_RPC Server 消息接收及回复 原理分析篇)
A brief introduction to the CheckboxListTile component of the basic components of Flutter
RESTful api interface design specification
已解决(最新版selenium框架元素定位报错)NameError: name ‘By‘ is not defined
(六)枚举、注解
Detailed explanation of TCP and UDP
[C language] General method of base conversion
Daily practice of LeetCode - palindrome structure of OR36 linked list
qlib自动化quant
errno错误码及含义(中文)
els block to the left to move the conditional judgment
SQL Interview Questions (Key Points)
Basic knowledge of mysql (2)
Recursive implementation of the Tower of Hanoi problem
识Flutter 基本组件之showTimePicker 方法
【论文阅读】Mastering the game of Go with deep neural networks and tree search
el-image标签绑定点击事件后没有有用
Redis 使用 sorted set 做最新评论缓存
Knowledge Distillation 7: Detailed Explanation of Knowledge Distillation Code