Skip to content
Cloudflare Docs

Operators

The following operators are supported:

Arithmetic operators

OperatorDescription
+addition
-subtraction
*multiplication
/division
%modulus

Comparison operators

OperatorDescription
=equals
<less than
>greater than
<=less than or equal to
>=greater than or equal to
<> or !=not equal
INtrue if the preceding expression's value is in the list
column IN ('a', 'list', 'of', 'values')
NOT INtrue if the preceding expression's value is not in the list
column NOT IN ('a', 'list', 'of', 'values')

We also support the BETWEEN operator for checking a value is in an inclusive range: a [NOT] BETWEEN b AND c.

Pattern matching operators New

OperatorDescription
LIKEtrue if the string matches the pattern (case-sensitive)
column LIKE 'pattern%'
NOT LIKEtrue if the string does not match the pattern (case-sensitive)
column NOT LIKE 'pattern%'
ILIKEtrue if the string matches the pattern (case-insensitive)
column ILIKE 'pattern%'
NOT ILIKEtrue if the string does not match the pattern (case-insensitive)
column NOT ILIKE 'pattern%'

Pattern matching supports two wildcard characters:

  • % matches any sequence of zero or more characters
  • _ matches any single character

Examples:

-- Match strings starting with "error"
WHERE blob1 LIKE 'error%'
-- Match strings ending with ".jpg" (case-insensitive)
WHERE blob2 ILIKE '%.jpg'
-- Match strings containing "test" anywhere
WHERE blob3 LIKE '%test%'
-- Match exactly 5 characters starting with "log"
WHERE blob4 LIKE 'log__'
-- Exclude strings containing "debug" (case-insensitive)
WHERE blob5 NOT ILIKE '%debug%'

Boolean operators

OperatorDescription
ANDboolean "AND" (true if both sides are true)
ORboolean "OR" (true if either side or both sides are true)
NOTboolean "NOT" (true if following expression is false and visa-versa)

Unary operators

OperatorDescription
-negation operator (for example, -42)