SQL like usage

Source: Internet
Author: User
Test Table. create Table test_like (like_value varchar (20 )); insert into test_like select '000000' Union all select '000000' Union all select 'abca' Union all select 'adcb 'Union all select 'abcc' Union all select 'abcd' Union all select 'abcde' Union all select 'xyz 10% off' Union all select 'xyz 20% off' Union all select 'xyz _ 123_abc '_ indicates that only one character of select * From test_likewhere like_value like is matched '1970 _'; like _ Value -------------------- 12345 (1 row affected) % indicates that only 0 or multiple characters are matched in select * From test_likewhere like_value like '000000'; like_value ------------------ 12345% (2 rows affected) use the pattern match select * From test_likewhere like_value like 'abc [ad] '; like_value ---------------- abcaabcd (2 rows affected) Select * From test_likewhere like_value like' [1A] % [5E] '; like_value -------------------- 12345 ABCDE (2 rows affected) use the escape definition Escape Character select * from Te St_likewhere like_value like '%! % 'Escape '! '; Like_value ------------------ XYZ 10% offxyz 20% off (2 rows affected) Select * From test_likewhere like_value like' %! _ % 'Escape '! '; Like_value ------------------ xyz_123_abc

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.