How to use MySQL like statement _mysql

Source: Internet
Author: User

Regexp
Example 1. The query field contains data that is not in English

Copy Code code as follows:

SELECT *
From ' M_user '
WHERE ' Emp_no '
REGEXP ' [^-~] ' =1

Column 2. So I can get all the English-free
Copy Code code as follows:

SELECT *
From table
WHERE Name
Not REGEXP ' [a-za-z0-9]+ '

Of course, in addition to RegExp can also use Find_in_set,like to operate
Find_in_set
How to use Find_in_set () in MySQL, and where to use Find_in_set (), and the F Second World Collation release Ind_in_set () and in () use the difference.
querying table field Pingid = (1,2,3,) in MySQL
Copy Code code as follows:

SELECT * from ' linkinfo ' WHERE ' pingid ' REGEXP ' {ID}, ' and ' pingid ' not REGEXP ' [[: Alnum:]]+{id}, '

Using the above statement, you can query out

Like
In MySQL, the SQL schema defaults to ignoring the case. Some examples are shown below. Note that when you use SQL mode, you cannot use = or! =; use like or not to compare operators.
SELECT field from table WHERE a field like condition
With regard to conditions, SQL provides four matching modes:
1,%: Represents any one or more characters. Can match characters of any type and length.
Like what

Copy Code code as follows:
Code to copy the code as follows
SELECT * FROM [user] WHERE u_name like '% III '

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.