07-SQLite like, wildcard (%,-, [char list], [^ char list], [! Char list]), 07-sqlitechar

Source: Internet
Author: User

07-SQLite like, wildcard (%,-, [char list], [^ char list], [! Char list]), 07-sqlitechar
I. Overview of like

The like operator is used to search for the specified mode syntax in the where clause: select column_name (s) from table_name where column_name likepattern;
2. Select data whose addr starts with "s" from the persons Table
Syntax: select * from persons where addr like's % '; Note: The above % is a wildcard (the part missing in the mode), as long as the first letter is s.

3. Select data whose addr ends with "j" from the persons Table
Syntax: select id, addr from persons where addr like '% J ';

4. Select the data information that addr contains "z" from the persons Table
Syntax: select * from persons where addr like '% z % ';

5. Select addr data that does not contain "z" from the persons table.
Syntax: select * from persons where addrnot like '% z % ';

6. SQL wildcards
Overview: the SQL wildcard can replace one or more characters, but must be used with the like

Wildcard Description
% Replace one or more characters
_ Replace only one character
[Char list] Any character in the character Column
[^ Char list] Any character not in the character Column
[! Char list] Any character not in the character Column

7. Use wildcards
Example 1: select the data information of "zb" after the first letter in the addr column from persons.

Note: [char list] results cannot be obtained in sqlite3









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.