MENU service case
 Website construction website design Beijing website construction high-end website production company Shangpin China
We create by embracing change
360 ° brand value__
simplified Chinese character
Simplified Chinese English

Shangpin China Joins Hands with Beisheng Internet to Create a New Chapter in Website Construction

Type: Shangpin Dynamic Learn more

Introduction to MySQL Query Like Fuzzy Query

Source: Shangpin China | Type: website encyclopedia | Time: April 28, 2019
General fuzzy query statements are as follows:
SELECT field FROM table WHERE A field Like condition
For conditions, SQL provides four matching modes:
 
1,%: indicates any 0 or more characters. It can match any type and length of characters. In some cases, if it is Chinese, please use two percent signs (%%).
For example, SELECT * FROM [user] WHERE u_name LIKE '% 3%'
We will find out all records with "three" such as u_name as "Zhang San", "Zhang Maosan", "Sanjiao", "Tang Sanzang", etc.
In addition, if you need to find records with both "three" and "cat" in u_name, please use the and condition
SELECT * FROM [user] WHERE u_name LIKE '% 3%' AND u_name LIKE '% Cat%'
If SELECT * FROM [user] WHERE u_name LIKE '% Three% Cat%' is used
Although it can search for "Trivial Cat", it can not search for "Zhang Maosan" who meets the conditions.
 
2, _: Any single character. Matches a single arbitrary character, which is often used to limit the character length of expressions:
For example, SELECT * FROM [user] WHERE u_name LIKE '_ three _'
Only find out "Tang Sanzang", where u_name is three characters and the middle one is "three";
Another example is SELECT * FROM [user] WHERE u_name LIKE 'three __';
Only find out that the name is three words and the first word is "three";
 
3, []: indicates one of the characters listed in parentheses (similar to regular expression). Specify a character, string or range, and the matching object must be any of them.
For example, SELECT * FROM [user] WHERE u_name LIKE '[Zhang Liwang] Three'
Will find out "Zhang San", "Li San", "Wang San" (not "Zhang Li Wang San");
If there are a series of characters (01234, abcde, etc.) in [], they can be abbreviated as "0-4", "a-e"
SELECT * FROM [user] WHERE u_name LIKE 'Old [1-9]'
Will find out "old 1", "old 2",..., "old 9";
 
4, [^]: indicates a single character not listed in parentheses. Its value is the same as [], but it requires the matched object to be any character other than the specified character.
For example, SELECT * FROM [user] WHERE u_name LIKE '[^ Zhang Liwang] Three'
"Zhao San" and "Sun San" who are not surnamed "Zhang", "Li" or "Wang" will be found out;
SELECT * FROM [user] WHERE u_name LIKE 'Old [^ 1-4]';
Will exclude "old 1" to "old 4", look for "old 5", "old 6"
 
Summary: MySQL queries record the information requested by all MySQL databases. Whether these requests are correctly executed or not. The default file name is hostname.log. MySQL queries are closed by default. In the production environment, if MySQL queries are enabled, the performance will be greatly affected. In addition, in many cases, MySQL slow queries can basically locate the SQL that has performance problems. Therefore, there are not many scenarios for MySQL query applications. It is a bit like the profiler in SQL Server, but it cannot track a session, user, or client. It can only track the entire database.
Source Statement: This article is original or edited by Shangpin China's editors. If it needs to be reproduced, please indicate that it is from Shangpin China. The above contents (including pictures and words) are from the Internet. If there is any infringement, please contact us in time (010-60259772).
TAG label:

What if your website can increase the number of conversions and improve customer satisfaction?

Make an appointment with a professional consultant to communicate!

* Shangpin professional consultant will contact you as soon as possible

Disclaimer

Thank you very much for visiting our website. Please read all the terms of this statement carefully before you use this website.

1. Part of the content of this site comes from the network, and the copyright of some articles and pictures involved belongs to the original author. The reprint of this site is for everyone to learn and exchange, and should not be used for any commercial activities.

2. This website does not assume any form of loss or injury caused by users to themselves and others due to the use of these resources.

3. For issues not covered in this statement, please refer to relevant national laws and regulations. In case of conflict between this statement and national laws and regulations, the national laws and regulations shall prevail.

4. If it infringes your legitimate rights and interests, please contact us in time, and we will delete the relevant content at the first time!

Contact: 010-60259772
E-mail: [email protected]

Communicate with professional consultants now!

  • National Service Hotline

    400-700-4979

  • Beijing Service Hotline

    010-60259772

Please be assured to fill in the information protection
Online consultation

Disclaimer

Thank you very much for visiting our website. Please read all the terms of this statement carefully before you use this website.

1. Part of the content of this site comes from the network, and the copyright of some articles and pictures involved belongs to the original author. The reprint of this site is for everyone to learn and exchange, and should not be used for any commercial activities.

2. This website does not assume any form of loss or injury caused by users to themselves and others due to the use of these resources.

3. For issues not covered in this statement, please refer to relevant national laws and regulations. In case of conflict between this statement and national laws and regulations, the national laws and regulations shall prevail.

4. If it infringes your legitimate rights and interests, please contact us in time, and we will delete the relevant content at the first time!

Contact: 010-60259772
E-mail: [email protected]