SQL wildcard characters

Source: Internet
Author: User

Wildcard characters include the following:

(1)%: denotes 0 or more characters

(2) _: Represents a single character (A_BC)

(3) []: Represents a single character within the range [a-f] [2-9]

(4) [^]: Represents a single character not in range [^a-f] [^2-9]

Syntax format: Test expression like ' wildcard '

Example: (1) SELECT * FROM table where name like ' sheet% '

(2) SELECT * from Yuesubiao where book_name like ' Javac! % ' escape '! '

(“ ! ": Used to differentiate between"% "in the characters to find and"% "in wildcards. Where the former "%" number is a character, after "%" is a wildcard)

ESCAPE Specifies the character that represents the escape, as specified above '! ' is an escape character.

SELECT * from Yuesubiao where book_name book_name like ' Kill!_% ' escape '! '

(3) SELECT * from staff where employee number + warehouse number like '%3% '

Equivalent to select * FROM employee where worker number like '%3% or warehouse number like '%3% '

SQL wildcard characters

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.