[MySQL] Filter with wildcards

Source: Internet
Author: User

The use of the LIKE operator is primarily used for wildcard searches in order to filter the data in a complex way.

Use wildcard characters to create a search pattern that compares specific data.

Percent percent (%) wildcard character

% indicates any number of occurrences of any character.

SELECT column name 1, column name 2 from table name WHERE column name 1 like condition (with one or more%);

% can match 0, one or more characters.

Underline (_) wildcard characters

The underscore _ matches only a single character instead of multiple characters.

SELECT column name 1, column name 2 from table name WHERE column name 1 like condition (containing _);

The underscore _ always matches one character and cannot be more or less.

Wildcard searches typically take longer to process than the other searches discussed earlier.

Tips for using wildcard characters:

1. Do not overuse wildcard characters

2. Try not to use wildcard characters at the beginning of the search pattern

3. Pay close attention to the position of the wildcard character

[MySQL] Filter with wildcards

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.