当前位置:网站首页>MySQL fuzzy query can use INSTR instead of LIKE
MySQL fuzzy query can use INSTR instead of LIKE
2022-07-31 04:12:00 【Dripping water can hide the sea】
The NSTR() function returns the position of the first occurrence of a substring in a string.The INSTR() function returns zero (0) if the substring is not found in str.
The syntax of the INSTR function is described below.
INSTR(str,substr);
The INSTR function accepts two parameters:
str is the string to search for.
substr is the substring to search for.
MySQL INSTR function example
The following statement returns the position of the substring SQL in the MySQL INSTR string.
SELECT INSTR('MySQL INSTR', 'SQL');
Execute the above query and get the following results:
mysql> SELECT INSTR('MySQL INSTR', 'SQL');+--------------------------------------------+| INSTR('MySQL INSTR', 'SQL') |+--------------------------------------------+| 3 |+--------------------------------------------+1 row in set
Example 2
SELECT * FROM sys_user where INSTR(name, 'a' )>0
Finds users whose username contains a, similar to LIKE '%a%'.
Discover other blogs (not written by the author):
Mysql's instr() function usage
边栏推荐
- 微软 AI 量化投资平台 Qlib 体验
- Pytest电商项目实战(上)
- ClickHouse:设置远程连接
- Bubble sort, selection sort, insertion sort, binary search directly
- BUG destroyer!!Practical debugging skills are super comprehensive
- RESTful api接口设计规范
- MATLAB/Simulink&&STM32CubeMX工具链完成基于模型的设计开发(MBD)(三)
- C language from entry to such as soil, the data store
- 安全20220718
- (五)final、抽象类、接口、内部类
猜你喜欢
Error EPERM operation not permitted, mkdir ‘Dsoftwarenodejsnode_cache_cacach两种解决办法
MySQL数据库安装配置保姆级教程(以8.0.29为例)有手就行
Basic knowledge of mysql (2)
IDEA common shortcut keys and plug-ins
Daily practice of LeetCode - palindrome structure of OR36 linked list
IIR filter and FIR filter
[Paper reading] Mastering the game of Go with deep neural networks and tree search
The application and practice of mid-to-platform brand advertising platform
How Zotero removes auto-generated tags
$attrs/$listeners
随机推荐
(六)枚举、注解
Why SocialFi achievement Web3 decentralized social in the future
递归实现汉诺塔问题
type_traits元编程库学习
Win10 CUDA CUDNN installation configuration (torch paddlepaddle)
errno error code and meaning (Chinese)
RESTful api interface design specification
MySQL基础操作
No qualifying bean of type question
Understanding and Using Unity2D Custom Scriptable Tiles (4) - Start to build a custom tile based on the Tile class (below)
mysql基础知识(二)
binom二项分布,
安全20220722
「 每日一练,快乐水题 」1331. 数组序号转换
[Swift] Customize the shortcut that pops up by clicking the APP icon
(4) Recursion, variable parameters, access modifiers, understanding main method, code block
Redis uses sorted set to cache latest comments
Notes on the establishment of the company's official website (6): The public security record of the domain name is carried out and the record number is displayed at the bottom of the web page
IIR filter and FIR filter
LeetCode每日一练 —— 138. 复制带随机指针的链表