The escape character in the SQL statement like clause [reproduced]

Source: Internet
Author: User

If you want to query in SQL like with an underscore ' _ ' or a '% ' equivalent of a record, write directly to like ' xxx_xx ', then ' _ ' will be treated as a wildcard character like. The escape clause is provided in SQL to handle this situation, and escape can specify what escape character is used in like, and the character after the escape character will be treated as the original character, which is much like the ' \ ' in C, but escape requires the custom escape character instead of the ' \ ' characters. Such as:

SELECT * FROM user_all_tables where table_name like ' yw__% ' escape ' _ '
The meaning is to identify all tables under the current user table that begin with ' Yw_ ', where the first ' _ ' is the escape character and the second is the escaped characters, the equivalent can be written as:
SELECT * FROM user_all_tables where table_name like ' yw\_% ' escape ' \ '

The escape character in the SQL statement like clause [reproduced]

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.