REGEXP
Example 1. the query field contains non-English data
Copy codeThe Code is as follows:
SELECT *
FROM'm _ user'
WHERE 'emp_no'
REGEXP '[^-~] '= 1
Column 2. In this way, all non-English content can be obtained.
Copy codeThe Code is as follows:
SELECT *
FROM table
WHERE name
Not regexp '[a-zA-Z0-9] +'
In addition to regexp, you can also use FIND_IN_SET and like to perform operations.
FIND_IN_SET
In mysql, how to use FIND_IN_SET (), and note the use of FIND_IN_SET (), as well as the differences between the use of IND_IN_SET () and in () in the second world.
Query the table field pingid = (1, 2, 3,) in mysql ,)
Copy codeThe Code is as follows:
SELECT * FROM 'linkinfo 'where 'pingid' REGEXP '{id},' AND 'pingid' not regexp '[[: alnum:] + {id },'
The preceding statement can be used for query.
Like
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.
SELECT field FROM table WHERE a field Like Condition
SQL provides four matching modes for conditions:
1, %: represents any or multiple characters. It can match characters of any type and length.
For example
Copy codeThe Code is as follows:
SELECT * FROM [user] WHERE u_name LIKE '% 3%'