Records containing characters in a MySQL query string

Source: Internet
Author: User
Tags mysql query

Regexp

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

The code is as follows Copy Code

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

Column 2. So I can get all the English-free

The code is as follows Copy Code

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

The code is as follows Copy Code
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

  code is as follows copy code
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.