当前位置:网站首页>MySQL fuzzy matching 1, 11111 similar string problems
MySQL fuzzy matching 1, 11111 similar string problems
2022-07-19 04:55:00 【Xiaoxinai programming】
Catalog
Problem analysis
Today I encountered a fuzzy matching problem , Generally speaking, go directly LIKE"%1%" That's it .
SELECT * FROM AFTFACT_TIMELY_OPT_DATADIVISION WHERE SCOPE_USER LIKE "%1%"

But the following , I found that there was no 1 The data of , But the lack was found , It turns out there are 11,111 This kind of data , because LIKE It's fuzzy matching , There are not many restrictions , So that's what happened ,111,11 Also found .
Now the problem has been found , To solve the problem .
Problem solving
CONCAT The function is to connect multiple strings into one string , At this time, we need to think about concat The problem of splicing , Is it possible to add something spliced? We can achieve this function , Then we get the following problem solving and implementation .
SELECT * FROM AFTFACT_TIMELY_OPT_DATADIVISION WHERE CONCAT(",",SCOPE_USER,",") LIKE "%,1,%"

Just add English before and after the execution field , In this way, the last situation will not occur after the implementation , It is also the result we want to find out .
summary
1、CONCAT function : Concatenate multiple strings into a single string .
2、 grammar :concat(str1, str2,…)
3、 Compare the usage of concatenated strings in other databases Oracle String connection uses “||” String splicing , How it is used and MSSQLServer The plus sign in “+” equally SELECT ‘ Your room number, :’ || NO || ‘ The unit price :’ || price FROM DUAL; Of course ,Oracle Chinese vs CONCAT() Functions are also supported
matters needing attention :
1、 If CONCAT The value connected in is not a string ,Oracle Will try to convert it to a string
2、 And MYSQL Of CONCAT() Functions are different ,Oracle Of CONCAT() Function only supports two parameters , Splicing of more than two strings is not supported
3、Oracle More than two parameters should be spliced in , Still have to use “||” Or you can use multiple CONCAT() Nested functions use
for example :
SELECT CONCAT(CONCAT(CONCAT('CSDN:',NO),' Test it :'),price) FROM DUAL;
边栏推荐
猜你喜欢

Freshman task-5

Project structure of wechat applet
![[Lipschitz] simulation of Lipschitz Lipschitz exponent based on MATLAB](/img/72/c69ed6e5538169c362b7b4bab36d5e.png)
[Lipschitz] simulation of Lipschitz Lipschitz exponent based on MATLAB

TiDB 性能分析和优化

TiDB 性能优化概述

shardingsphere内核原理

UE-插件 ElectronicNodes 5.0.0/4.23-4.27

【Lipschitz】基于matlab的Lipschitz李氏指数仿真

Tidb performance analysis and optimization

渗透测试 10 --- 扫描 web目录 (dirb、wfuzz、wpscan、nikto)
随机推荐
ThinkPHP official website tutorial
tidb 学习
.sh脚本编写
MySQL必知必会!!!看这一篇就足够了!!!
Project team summer vacation summary 02
[FPGA tutorial case 26] realize the basic operation of decimals through Verilog in FPGA
Web development with fastapi
redis 安装
脱敏字段举例
网址在线封装APK系统源码
毕设:基于Vue+Socket+Redis的分布式高并发防疫健康管理系统
数据库取配置文件字段,然后进行数据处理和判断
Hyperlink implementation post submission
Pingcap clinic data acquisition instructions
Constraints on MySQL tables (Basics)
根据日期重新排列数据js
Reproduction of XOR and encryption decryption
Load balancer ribbon practice
数据库与开源的未来
浅聊全局过滤器