Binary Expressions

Binary operators take two values as parameter expressions and combine or compare them in some way that produces an output value. This section includes all of the operators with nonkeyword representations, plus AND and OR. With the exception of AND and OR, all of these operators will produce a NULL result if either parameter expression is NULL.

image with no caption

SQLite supports the following binary expression operators:

|| String concatenation

The || operator is used to concatenate text values. This operator is defined by the SQL standard. Although some databases support the nonstandard + operator for concatenating text values, SQLite does not. Non-NULL parameter expressions will first be converted to text values.

* Multiplication

Standard numeric multiplication of two numbers. Non-NULL parameter expressions will first be converted to numeric values. If both expressions are integers, the result will also be an integer.

/ Division

Standard numeric division of two numbers. The result will be the lefthand operator divided by the righthand operator. Non-NULL parameter expressions will first be converted to numeric values. If both expressions are integers, the integer division will be used and the result will also be an integer.

% Modulo or remainder

Standard numeric modulo of two numbers. The expression value will be the remainder of the left operator divided by the right. If either parameter ...

Get Using SQLite now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.