SQL

Operators

You can use various types of operators in your SQL queries to perform operations on your data.

Logical Operators

You can use the following logical operators in SQL queries:

  • AND
  • BETWEEN (Includes endpoints. For example, if a query states WHERE age BETWEEN 10 AND 20, Node returns both 10 and 20 in the result.)
  • IN
  • LIKE
  • NOT
  • OR

Comparison Operators

You can use the following comparison operators in your SQL queries:

  • <
  • >
  • <=
  • >=
  • =
  • <>
  • IS NULL
  • IS NOT NULL
  • IS FALSE
  • IS NOT FALSE
  • IS TRUE
  • IS NOT TRUE

Pattern Matching Operators

You can use the LIKE pattern matching operator in your SQL queries.

Math Operators

You can use the following math operators in your SQL queries:

OperatorDescription
+Addition
-Subtraction
*Multiplication
/Division

Subquery Operators

You can use the following subquery operators in your SQL queries:

  • EXISTS
  • IN

See [SELECT Statements](/docs/select).

String Concatenate Operator

You can use the following string operator in your SQL queries to concatenate strings:

  • string || string

The concatenate operator is an alternative to the concat function and will concatenate input if Node can implicitly convert the input to a string.

The concat function treats NULL as an empty string. The concatenate operator (||) returns NULL if any input is NULL.

Operator Precedence

The following table shows the precedence of operators in decreasing order:

Operator/ElementAssociativityDescription
.leftdot notation used, for example, to step down in a JSON map
leftarray-style notation to step down into a JSON array
-rightunary minus
Eleftexponentiation
* / %leftmultiplication, division, modulo
+ -leftaddition, subtraction
ISIS TRUE, IS FALSE, IS UNKNOWN, IS NULL
IS NULLtest for null
IS NOT NULLtest for not null
(any other)leftall other native and user-defined operators
INset membership
BETWEENrange containment, includes end points
OVERLAPStime interval overlap
LIKE ILIKEstring pattern matching
SIMILAR TO NOT SIMILAR TOstring pattern matching
< >less than, greater than
=rightequality, assignment
NOTrightlogical negation
ANDleftlogical conjunction
ORleftlogical disjunction