Wildcards in the like Statement of MySql: percent, underline, and escape

Source: Internet
Author: User

Wildcard characters: percent, underline, and escape % in the like Statement of MySql indicate any number of characters in the SQL code www.2cto.com select * from user where username like '% huxiao '; select * from user where username like 'huxiao % '; select * from user where username like' % huxiao % '; _ indicates a single character SQL code select * from user where username like '_'; select * from user where username like 'huxia _'; select * from user where username like 'H _ xiao '; what if I want to check % or? If you use escape, the % or _ following the escape character is not used as a wildcard, note that the % and _ characters without escape characters are still used as wildcards. SQL code select username from gg_user where username like '% xiao/_ % 'escape '/'; select username from gg_user where username like '% xiao/%' escape '/';

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.