There are several types of sqlite operators, arithmetic operators, comparison operators, logical operators, bitwise operators
1, arithmetic operators
Arithmetic operators mainly have +-*,% (take-out) This is very simple, for example, to achieve such an effect requires the format of the row output. Mode line
SQLite>Select3; - % 3 = 2 SQLite >
2, Comparison operators
Comparison operators, as long as the basic knowledge of the language learned, is nothing more than >, <, ==,!=, <> (unequal),>=,<=,!< (not less than),!> (not greater than), this is actually very simple, give an example on the line
SQLite>Select*fromwhere>2; ID name Age -- --- ---------- ----------3 cc sqlite >
3, logical operators
Logical operators SQLite But there are a lot of
This requires an example.
sqlite> select * from student where ID == 1 and Name == -- ----------------------- 1 aa 23 >
sqlite> select * from student where ID between 2 and 3 ;id name Age -- ----------------------- 2 bb 12 3 cc 45 >
sqlite> select * from student where ID in (2 , 3 -- ----------------------- 2 BB 12 3 cc 45 SQLite >
sqlite> select * from student where ID not in (2 , Span style= "color: #800000; Font-weight:bold; " >3 -- ----------------------- 1 AA 23 SQLite >
sqlite> select * from student where name like "B% "; ID name age -- ---------------------------- Span style= "color: #800000; Font-weight:bold; " >2 bb 12 SQLite >
SQLite>Select*fromwherenotbetween2 and 3 ID name age---------- ---------- ----------1 AA @ sqlite>
4, bitwise operator
operator |
Description |
Example |
& |
If both are present in two operands, the binary and operator copies one to the result. |
(A & B) will be 12, i.e. 0000 1100 |
| |
If it exists in either operand, the binary OR operator copies one into the result. |
(A | B) will get 61, i.e. 0011 1101 |
~ |
The binary complement operator is a unary operator with a "flip" bit effect. |
(~a) will get-61, which is 1100 0011,2 of the complement form, signed binary number. |
<< |
Binary left shift operator. The value of the left operand moves the number of digits specified by the right operand to the left. |
A << 2 will get 240, which is 1111 0000 |
>> |
Binary right-shift operator. The value of the left operand moves the right operand to the specified number of digits. |
A >> 2 will get 15, which is 0000 1111
|
Basic usage of SQLite 2