Operators
Operators in Redpanda SQL are special symbols used in expressions to compare, combine, or manipulate values.
Comparison operators
| Operator | Name | Description | Example |
|---|---|---|---|
|
Equal to |
The value of one item is equal to another item’s value. |
|
|
Not equal to |
The value of one item is not equal to the other item’s value. |
|
|
Greater than |
The value of one item is greater than another item’s value. |
|
|
Less than |
The value of one item is less than another item’s value. |
|
|
Greater than or equal to |
The value of one item is greater than or equal to the other item’s value. |
|
|
Less than or equal to |
The value of one item is less than or equal to the other item’s value. |
|
Logical operators
| Operator | Name | Description | Example |
|---|---|---|---|
|
Logical AND |
Returns true if both conditions are true. |
|
|
Logical OR |
Returns true if at least one condition is true. |
|
|
Logical NOT |
Reverses the result of a condition. |
|
Null and boolean test operators
| Operator | Description | Example |
|---|---|---|
|
Returns true if the value is NULL. |
|
|
Returns true if the value is not NULL. |
|
|
Returns true if the two values are not equal, treating NULL as a comparable value. |
|
|
Returns true if the two values are equal, treating NULL as a comparable value. |
|
|
Returns true if the boolean value is true. |
|
|
Returns true if the boolean value is not true (false or NULL). |
|
|
Returns true if the boolean value is false. |
|
|
Returns true if the boolean value is not false (true or NULL). |
|
Arithmetic operators
| Operator | Name | Description | Example |
|---|---|---|---|
|
Addition |
Adds two values, or acts as unary positive. |
|
|
Subtraction |
Subtracts one value from another, or negates a value. |
|
|
Multiplication |
Multiplies two values. |
|
|
Division |
Divides one value by another. |
|
|
Modulus |
Returns the remainder of a division. |
|
Mathematical operators
| Operator | Name | Description | Example |
|---|---|---|---|
|
Absolute value |
Returns the absolute value of a number. |
|
|
Exponentiation |
Raises a number to a power. |
|
|
Square root |
Returns the square root of a number. |
|
|
Cube root |
Returns the cube root of a number. |
|
Bitwise operators
| Operator | Name | Description | Example |
|---|---|---|---|
|
Bitwise AND |
Performs a bitwise AND on two integers. |
|
|
Bitwise OR |
Performs a bitwise OR on two integers. |
|
|
Bitwise XOR |
Performs a bitwise exclusive OR on two integers. |
|
|
Bitwise NOT |
Performs a bitwise NOT (complement) on an integer. |
|
Bitwise shift left |
Shifts the bits of an integer to the left. |
|
|
Bitwise shift right |
Shifts the bits of an integer to the right. |
|
String and pattern matching operators
| Operator | Name | Description | Example |
|---|---|---|---|
|
Concatenation |
Concatenates two strings, or appends elements to an array. |
|
|
LIKE |
Returns true if the string matches the pattern. |
|
|
NOT LIKE |
Returns true if the string does not match the pattern. |
|
|
ILIKE |
Case-insensitive LIKE pattern matching. |
|
|
NOT ILIKE |
Case-insensitive NOT LIKE pattern matching. |
|
|
Regex match |
Returns true if the string matches the regular expression. |
|
|
Regex match (case-insensitive) |
Case-insensitive regular expression match. |
|
|
Regex not match |
Returns true if the string does not match the regular expression. |
|
|
Regex not match (case-insensitive) |
Case-insensitive regular expression non-match. |
|
JSON operators
| Operator | Name | Description | Example |
|---|---|---|---|
|
|
Extracts a |
|
|
|
Extracts a |
|
Array operators
| Operator | Name | Description | Example |
|---|---|---|---|
|
Any element equals |
Returns true if any element in the array matches the value. |
|
|
All elements equal |
Returns true if all elements in the array match the value. |
|