Skip to main content

Operators

Supported Arithmetic Operators

OperatorDescription
+ (Addition)Adds values on either side of the operator
- (Subtraction)Subtracts the right hand operand from the left hand operand
* (Multiplication)Multiplies values on either side of the operator
/ (Division)Divides the left hand operand by the right hand operand
% (Modulus)Divides the left hand operand by the right hand operand and returns the remainder

Supported Comparison Operator

OperatorDescription
==Checks if the values of two operands are equal or not, if yes then the condition becomes true.
=Checks if the values of two operands are equal or not, if yes then the condition becomes true.
!=Checks if the values of two operands are equal or not, if the values are not equal, then the condition becomes true.
<>Checks if the values of two operands are equal or not, if the values are not equal, then the condition becomes true.
>Checks if the values of the left operand is greater than the value of the right operand, if yes then the condition becomes true.
<Checks if the values of the left operand is less than the value of the right operand, if yes then the condition becomes true.
>=Checks if the value of the left operand is greater than or equal to the value of the right operand, if yes then the condition becomes true.
<=Checks if the value of the left operand is less than or equal to the value of the right operand, if yes then the condition becomes true.
ISThe IS operator is used in SQL to compare a value against NULL. It is used with the NULL keyword to check if a value is NULL. For example, column_name IS NULL would return true if the value in column_name is NULL.
IS NOTThe IS NOT operator is used to check if a value is not NULL. For example, column_name IS NOT NULL would return true if the value in column_name is not NULL.
INThe IN operator is used to check if a value matches any value in a list or a subquery. For example, column_name IN (value1, value2, ...)
NOT INThe NOT IN operator is used to check if a value does not match any value in a list or subquery. For example, column_name NOT IN (value1, value2, ...).

Supported Logical Operators

OperatorDescription
ANDThe AND operator allows the existence of multiple conditions in an SQL statement's WHERE clause.
ORThe OR operator is used to combine multiple conditions in an SQL statement's WHERE clause.

Supported String Operators

OperatorDescription
LIKEFor pattern matching against a specific column or string. The pattern can include wildcard characters like % (matches any sequence of characters) and _ (matches any single character).
NOT LIKESelect the rows that do not match the specified LIKE pattern.
GLOBSimilar to LIKE, but it uses a different wildcard pattern matching syntax. In a GLOB pattern, * matches any sequence of characters, and ? matches any single character.
NOT GLOBSelect the rows that do not match the specified GLOB pattern.
REGEXPRegular expressions define a search pattern using special characters and quantifiers to match specific patterns in the data.
NOT REGEXPSelect the rows that do not match the specified regular expression pattern.
MATCHSelect the rows that match the specified full-text search query.
NOT MATCHSelect the rows that do not match the specified full-text search query.

Supported Bitwise Operators

OperatorDescription
&And
|OR
~Not
<<Left Shift
>>Right Shift

Supported Unary Operators

OperatorDescription
+ (Unary Plus)The unary plus operator simply returns the value of the operand as is.
- (Unary Minus)The unary minus operator negates the value of the operand.
~ (Bitwise NOT)The bitwise NOT operator performs a bitwise negation on the operand, flipping each bit.
NOT (Logical NOT)The logical NOT operator returns the boolean opposite of the operand. It is used to negate a boolean value.

Operator Precedence Table

PrecedenceOperators1
1~ [expr]     + [expr]     - [expr]
2[expr] COLLATE (collation-name)2
3||     ->     ->>
4*     /     %
5+     -
6&     |     <<     >>
7[expr] ESCAPE [escape-character-expr]3
8<       >       <=       >=
9=     ==     <>     !=     IS     IS NOT
IS DISTINCT FROM     IS NOT DISTINCT FROM
[expr] BETWEEN4 [expr] AND [expr]
IN4     MATCH4     LIKE4     REGEXP4     GLOB4
            [expr] ISNULL     [expr] NOTNULL     [expr] NOT NULL            
10NOT [expr]
11AND
12OR
  1. "[expr]" denotes operand locations for non-binary operators. Operators with no "[expr]" adjunct are binary and left-associative.
  2. The COLLATE clause (with its collation-name) acts as a single postfix operator.
  3. The ESCAPE clause (with its escape character) acts as a single postfix operator. It can only bind to a preceding [expr] LIKE [expr] expression.
  4. Each keyword in (BETWEEN IN GLOB LIKE MATCH REGEXP) may be prefixed by NOT, retaining the bare operator's precedence and associativity.