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