w3resource logo


SQLite operators

SQLite Operators

Secondary Nav

What are SQL operators?

An operator performs on separate data items and returns a result. The data items are called operands or arguments. Operators are mentioned by special characters or by keywords. For example , the plus operator is represented by a plus (+) sign.

Types of SQLite operators

Sql operators Description
SQLite Arithmetic Operator Arithmetic operators can perform arithmetical operations on numeric operands involved. Arithmetic operators are addition(+), subtraction(-), multiplication(*) and division(/). The + and - operators can also be used in date arithmetic.
SQLite Comparison Operator Comparison operators are used in conditions that compares one expression with another. The result of any binary operator is either a numeric value ( 1 (true), 0(false) ) or NULL, except for the || concatenation operator which always evaluates to either NULL or a text value.
SQLite Boolean Operator The Boolean operators are those that are true or false. They return a true or false values to combine one or more true or false values.
SQLite LIKE and GLOBE Operators The LIKE operator does a pattern matching comparison. The operand to the right of the LIKE operator contains the pattern and the left-hand operand contains the string to match against the pattern. The GLOB operator is similar to LIKE but uses the Unix file globbing syntax for its wildcards. Also, GLOB is case sensitive, unlike LIKE.
SQLite BETWEEN Operator The BETWEEN operator is logically equivalent to a pair of comparisons. "a BETWEEN b AND c" is equivalent to "a>=b AND a<=c" except that with BETWEEN, the expression is only evaluated once. The precedence of the BETWEEN operator is the same as the precedence as operators == and != and LIKE and groups left to right.
SQLite IN and NOT IN Operators The IN operator checks a value within a set of values separated by commas and retrieve the rows from the table which are matching. The IN returns 1 when the search value presents within the range otherwise returns 0.
EXISTS Operator The EXISTS operator always evaluates to one of the integer values 0 and 1. If executing the SELECT statement specified as the right-hand operand of the EXISTS operator would return one or more rows, then the EXISTS operator evaluates to 1. If executing the SELECT would return no rows at all, then the EXISTS operator evaluates to 0.
REGEXP Operator The REGEXP operator is a special syntax for the regexp() user function. No regexp() user function is defined by default and so the use of the REGEXP operator will normally result in an error message.

SQLite operators : Highest to Lowest precedence

||

*    /    %

+     -

<<     >>     &     |

<    <= >     >=

=     ==     !=     <>     IS     IS NOT     IN     LIKE    GLOB     MATCH     REGEXP

AND

OR

Supported unary prefix operators are these: - + ~ NOT

 



Join our Question Answer community to learn and share your programming knowledge.

Help the community:

Python: Fizzbuzz

C++: Decimal to binary conversion

JavaScript: Need Help in JavaScript

Python: Help me with this program