In the SQL like statement, for example SELECT * FROM user WHERE username LIKE '%luchi%' SELECT * FROM user WHERE username LIKE '_luchi_',
But when the field to be queried by like contains %, how do we check: At this time, you need to specify that the '%' in the field is not used as a wildcard; test: Here we use this table Before escaping: SELECT * FROM user WHERE username LIKE '%%%'; Here you will find that the three % signs are all treated as wildcards; After escaping: SELECT * FROM user WHERE username LIKE '%1%%' ESCAPE '1'; Query successful Note:
Tips and Suggestions:MySQL wildcards are very useful. This functionality comes at a cost, however: wildcard searches generally take longer to process than the other searches discussed previously. Here are some tips to remember when using wildcards.
This is the end of this article on how to use MySQL like to query fields containing '%' (ESCAPE usage). For more information about MySQL like query %, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Native JS to achieve blinds special effects
>>: Solution to Nginx SSL certificate configuration error
Use the system crontab to execute backup files re...
During this period of time, I was studying docker...
The replace statement is generally similar to ins...
html Copy code The code is as follows: <SPAN cl...
In actual development or production environments,...
1. Introduction WHMCS provides an all-in-one solu...
question First, let me talk about the problem I e...
This article shares the specific code for impleme...
Preface Ordinary users define crontab scheduled t...
Table of contents Why use setState Usage of setSt...
Note: In web development, after adding autocomplet...
0. What is a tag? XML/HTML CodeCopy content to cl...
Currently, layui officials have not provided the ...
If you have a choice, you should use UTF-8 In fac...
MySQL Limit can query database data in segments a...