Basic usage of SQLite 3

Source: Internet
Author: User
Tags glob sqlite

The and operator and the OR operator

These two operators, commonly referred to as join operators, are used to reduce the data selected by SQLite

The AND operator is true when all conditions are true

SQLite>Select*fromwhere=2and=  "BB"; ID       nameage----------  ----------  ---------- 2           BB          >         sqlite

The

Or operator is true if one of the conditions is true

 sqlite>  select  *  from  student where  ID =  5  or  name " Span style= "color: #808080;" >=   ------------------------------  2  bb 12  4  bb 45   SQLite  >  

The UPDATE statement is used to modify the records in the table and can be used in the WHERE statement to select the record line, otherwise all records will be modified

Sqlite> UpdateStudentSetAge=  A whereId= 3; SQLite> Select *  fromstudent;id name age----------  ----------  ----------2Bb A        3Cc A        1ABCdef About        4Bb $SQLite> 

Delete statements are used to delete records in a database in general and where

Sqlite> Delete  fromStudentwhereId= 4; SQLite> Select *  fromstudent;id name age----------  ----------  ----------2Bb A        3Cc A        1ABCdef AboutSQLite> 

The like operator of SQLite is the literal value used to match the wildcard specified pattern. If the search expression matches the pattern expression, the LIKE operator returns True (TRUE), which is 1. Here are two wildcard characters to use with the LIKE operator:

    • Percent percent (%)

    • Underline (_)

A percent symbol (%) represents 0, one or more digits or characters. An underscore (_) represents a single number or character. These symbols can be used in combination.

Sqlite> Select *  fromStudentwhereName like"%Cd%"; ID name age----------  ----------  ----------1ABCdef AboutSQLite> Select *  fromStudentwhereName like"b_"; ID name age----------  ----------  ----------2Bb ASQLite> 

The GLOB operator of SQLite is the literal value used to match the wildcard specified pattern. If the search expression matches the pattern expression, the GLOB operator returns True (TRUE), which is 1. Unlike the LIKE operator, GLOB is case-sensitive and follows the UNIX syntax for the following wildcard character.

    • asterisk (*)

    • Question mark (?)

An asterisk (*) represents 0, one, or more digits or characters. The question mark (?) represents a single number or character. These symbols can be used in combination.

Sqlite> Select *  fromStudentwhereName Glob "*Cd*"; ID name age----------  ----------  ----------1ABCdef AboutSQLite> Select *  fromStudentwherename Glob "B?"; ID Name Age----------  ----------  ----------2Bb ASQLite> 

The limit clause of SQLite is used to limit the amount of data returned by the SELECT statement, sometimes with offset

Sqlite> Select *  fromStudent Limit2; ID Name age----------  ----------  ----------2Bb A        3Cc ASQLite> Select *  fromStudent Limit2Offset1;; ID Name Age----------  ----------  ----------3Cc A        1ABCdef AboutSQLite> 

Basic usage of SQLite 3

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.