SQL pattern matching allows you to use "_" to match any single character, while "%" matches any number of characters (including zero characters ). In MySQL, the SQL mode is case-insensitive by default. Some examples are shown below. Note that when you use SQL mode, you cannot use = or! =; And use the LIKE or not like comparison operator.
Mysql full-text search written in the previous article. Now let's look at SQL fuzzy search. We usually use %? *-To replace the search content
MySQL provides standard SQL mode matching and an extended regular expression mode matching format based on Unix utilities such as vi, grep, and sed.
SQL pattern matching allows you to use "_" to match any single character, while "%" matches any number of characters (including zero characters ). In MySQL, the SQL mode is case-insensitive by default. Some examples are shown below. Note that when you use SQL mode, you cannot use = or! =; And use the LIKE or not like comparison operator.
Let's take a look at an SQL like instance tutorial.
Select * from customer where name like 'wang % ';
Here is the name of the person whose name starts with Wang Kai.
"? "Or" _ "(underline) any single character
"*" Or "%" zero or multiple characters
"#" Any single number (0-9)
[Charlist] any single character in the orders table
[! Charlist] any single character not in the orders table
Note that only Microsoft®When Jet 4.X and Microsoft ole db Provider for Jet, ansi SQL wildcards (%) and (_) are available. If Microsoft Access or DAO is used, it is considered as a literal character.