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
A simple license plate input component (vue) for ...
Tutorial Series MySQL series: Basic concepts of M...
Create a table CREATE TABLE `map` ( `id` int(11) ...
Use the vscode editor to create a vue template, s...
Table of contents Preliminary preparation Deploym...
Table of contents How to view the source code of ...
Ubuntu 16.04 installs the PHP7.0 environment by d...
0. Preparation: • Close iTunes • Kill the service...
Table of contents background What is tablespace f...
There is a simple CSS method to realize the pop-u...
I started using Linux for development and enterta...
In the previous article, we have realized the sim...
Aggregating data from various sources allows the ...
Macrotasks and Microtasks JavaScript is a single-...
Teaching Topics Web page Applicable grade Second ...