1. Like operator
Previously used operators are for known data, and wildcard characters can also be used to search for unknown data.
wildcard character (wildcard): used to match Special characters that are worth a portion.
Search pattern: A search condition consisting of a literal value, a wildcard character, or a combination of both.
To use a wildcard character for a search clause, you must use the LIKE operator because it indicates MySQL, followed by a wildcard match instead of a direct equality match.
predicate: When an operator acts as a predicate, it is no longer an operator and like is a predicate.
2, percent semicolon wildcard character%
% indicates any number of occurrences of any character.
Input: SELECT prod_id,prod_name
From Products
WHERE prod_name like ' jet% ';
Analysis: Show two columns-Product ID and name, table source-products, filter terms the product name first three characters is jet (regardless of case, but the search mode can be set case-insensitive, not set here).
Note: Wildcards can appear anywhere in the search mode, the number is arbitrary, such as: Like '%jet% ', such as ' s%e ', wildcard characters in addition to one or more characters, can also match 0 characters, so the wildcard range is actually 0-∞. Wildcard characters cannot match null.
3, underline the wildcard character (_)
The underscore wildcard can match only one character.
4. Tips for using wildcard characters
Do not overuse wildcard characters, which are at the cost of performance.
Be sure to use a wildcard character, and do not place it at the beginning of the search pattern.
"MySQL is better than know." The eighth chapter is filtered with a wildcard character