---
title: SQL operators
description: SQL operators are reserved words or characters which perform certain operations, including comparisons and arithmetic.
url: https://docs.influxdata.com/influxdb3/clustered/reference/sql/operators/
estimated_tokens: 1731
publisher: InfluxData
canonical: https://docs.influxdata.com/influxdb3/clustered/reference/sql/operators/
date: '2025-04-03T12:43:17-06:00'
lastmod: '2025-04-03T12:43:17-06:00'
---

SQL operators are reserved words or characters which perform certain operations,
including comparisons and arithmetic.

* [Arithmetic operators](#arithmetic-operators)
* [Comparison operators](#comparison-operators)
* [Logical operators](#logical-operators)
* [Bitwise operators](#bitwise-operators)
* [Other operators](#other-operators)

## [Arithmetic operators](/influxdb3/clustered/reference/sql/operators/arithmetic/)

Arithmetic operators take two numeric values (either literals or variables) and perform a calculation that returns a single numeric value.

|Operator| Description  |Example|Result|
|--------|--------------|-------|------|
|  `+`   |   Addition   |`2 + 2`| `4`  |
|  `-`   | Subtraction  |`4 - 2`| `2`  |
|  `*`   |Multiplication|`2 * 3`| `6`  |
|  `/`   |   Division   |`6 / 3`| `2`  |
|  `%`   |    Modulo    |`7 % 2`| `1`  |

## [Comparison operators](/influxdb3/clustered/reference/sql/operators/comparison/)

Comparison operators evaluate the relationship between the left and right operands and return `true` or `false`.

|       Operator       |                        Meaning                         |         Example          |
|----------------------|--------------------------------------------------------|--------------------------|
|         `=`          |                        Equal to                        |       `123 = 123`        |
|         `<>`         |                      Not equal to                      |       `123 <> 456`       |
|         `!=`         |                      Not equal to                      |       `123 != 456`       |
|         `>`          |                      Greater than                      |         `3 > 2`          |
|         `>=`         |                Greater than or equal to                |         `3 >= 2`         |
|         `<`          |                       Less than                        |         `1 < 2`          |
|         `<=`         |                 Less than or equal to                  |         `1 <= 2`         |
|  `IS DISTINCT FROM`  |                    Is distinct from                    |  `0 IS DISTINCT FROM 1`  |
|`IS NOT DISTINCT FROM`|                  Is not distinct from                  |`0 IS NOT DISTINCT FROM 1`|
|         `~`          |              Matches a regular expression              |     `'abc' ~ 'a.*'`      |
|         `~*`         |   Matches a regular expression *(case-insensitive)*    |     `'Abc' ~* 'A.*'`     |
|         `!~`         |          Does not match a regular expression           |     `'abc' !~ 'd.*'`     |
|        `!~*`         |Does not match a regular expression *(case-insensitive)*|    `'Abc' !~* 'a.*'`     |

## [Logical operators](/influxdb3/clustered/reference/sql/operators/logical/)

Logical operators combine or manipulate conditions in a SQL query.

|Operator |                                 Meaning                                  |
|---------|--------------------------------------------------------------------------|
|  `AND`  |    Returns true if both operands are true. Otherwise, returns false.     |
|`BETWEEN`|Returns true if the left operand is within the range of the right operand.|
|`EXISTS` |         Returns true if the results of a subquery are not empty.         |
|  `IN`   |      Returns true if the left operand is in the right operand list.      |
| `LIKE`  |Returns true if the left operand matches the right operand pattern string.|
|  `NOT`  |                    Negates the subsequent expression.                    |
|  `OR`   |      Returns true if any operand is true. Otherwise, returns false.      |

## [Bitwise operators](/influxdb3/clustered/reference/sql/operators/bitwise/)

Bitwise operators perform bitwise operations on bit patterns or binary numerals.

|Operator|      Meaning      |Example |Result|
|--------|-------------------|--------|------|
|  `&`   |    Bitwise and    |`5 & 3` | `1`  |
|  `|`   |    Bitwise or     |`5 | 3` | `7`  |
|  `^`   |    Bitwise xor    |`5 ^ 3` | `6`  |
|  `>>`  |Bitwise shift right|`5 >> 3`| `0`  |
|  `<<`  |Bitwise shift left |`5 << 3`| `40` |

## [Other operators](/influxdb3/clustered/reference/sql/operators/other/)

SQL supports other miscellaneous operators that perform various operations.

|   Operator   |        Meaning         |                                     Example                                      |   Result    |
|--------------|------------------------|----------------------------------------------------------------------------------|-------------|
|     `||`     |  Concatenate strings   |                              `'Hello' || ' world'`                               |`Hello world`|
|`AT TIME ZONE`|Apply a time zone offset|*[View example](/influxdb3/clustered/reference/sql/operators/other/#at-time-zone)*|             |
| Operator | Description | Example | Result |
| --- | --- | --- | --- |
| Operator | Description | Example | Result |
| + | Addition | 2 + 2 | 4 |
| - | Subtraction | 4 - 2 | 2 |
| * | Multiplication | 2 * 3 | 6 |
| / | Division | 6 / 3 | 2 |
| % | Modulo | 7 % 2 | 1 |

| Operator | Meaning | Example |
| --- | --- | --- |
| Operator | Meaning | Example |
| = | Equal to | 123 = 123 |
| <> | Not equal to | 123 <> 456 |
| != | Not equal to | 123 != 456 |
| > | Greater than | 3 > 2 |
| >= | Greater than or equal to | 3 >= 2 |
| < | Less than | 1 < 2 |
| <= | Less than or equal to | 1 <= 2 |
| IS DISTINCT FROM | Is distinct from | 0 IS DISTINCT FROM 1 |
| IS NOT DISTINCT FROM | Is not distinct from | 0 IS NOT DISTINCT FROM 1 |
| ~ | Matches a regular expression | 'abc' ~ 'a.*' |
| ~* | Matches a regular expression  (case-insensitive) | 'Abc' ~* 'A.*' |
| !~ | Does not match a regular expression | 'abc' !~ 'd.*' |
| !~* | Does not match a regular expression  (case-insensitive) | 'Abc' !~* 'a.*' |

| Operator | Meaning |
| --- | --- |
| Operator | Meaning |
| AND | Returns true if both operands are true. Otherwise, returns false. |
| BETWEEN | Returns true if the left operand is within the range of the right operand. |
| EXISTS | Returns true if the results of a subquery are not empty. |
| IN | Returns true if the left operand is in the right operand list. |
| LIKE | Returns true if the left operand matches the right operand pattern string. |
| NOT | Negates the subsequent expression. |
| OR | Returns true if any operand is true. Otherwise, returns false. |

| Operator | Meaning | Example | Result |
| --- | --- | --- | --- |
| Operator | Meaning | Example | Result |
| & | Bitwise and | 5 & 3 | 1 |
| | | Bitwise or | 5 | 3 | 7 |
| ^ | Bitwise xor | 5 ^ 3 | 6 |
| >> | Bitwise shift right | 5 >> 3 | 0 |
| << | Bitwise shift left | 5 << 3 | 40 |

| Operator | Meaning | Example | Result |
| --- | --- | --- | --- |
| Operator | Meaning | Example | Result |
| || | Concatenate strings | 'Hello' || ' world' | Hello world |
| AT TIME ZONE | Apply a time zone offset | View example |  |
