SQLite Operators
Arithmetic Operators
| Operator | Description |
|---|---|
+ | Add |
- | Subtract |
* | Multiply |
/ | Divide |
% | Modulo (the remainder of a division) |
Integer Division
When you divide an integer by an integer, SQLite gives an integer, and the decimals are cut off. Use a decimal number to get the decimals:
Comparison Operators
| Operator | Description |
|---|---|
= or == | Equal |
<> or != | Not equal |
> | Greater than |
< | Less than |
>= | Greater than or equal |
<= | Less than or equal |
IS | Equal, and NULL is equal to NULL |
IS NOT | Not equal, and NULL is equal to NULL |
Example
Select the products that cost exactly 18:
SELECT * FROM Products
WHERE Price = 18;
Try it Yourself »
Logical Operators
| Operator | Description |
|---|---|
| AND | True if all the conditions are true |
| OR | True if at least one condition is true |
| NOT | Turns a condition around |
| BETWEEN | True if the value is in a range |
| IN | True if the value is in a list |
| LIKE | True if the value matches a pattern |
| GLOB | True if the value matches a pattern, with case sensitivity |
| EXISTS | True if a subquery returns any records |
String Operators
|| joins two texts together:
SQLite 3.38.0 and later also has the JSON operators -> and ->>. Read more in the SQLite JSON chapter.
Bitwise Operators
| Operator | Description |
|---|---|
& | Bitwise AND |
| | Bitwise OR |
~ | Bitwise NOT |
<< | Shift left |
>> | Shift right |