NOT_BETWEEN()

All functions > COMPARISON > NOT_BETWEEN()

Returns TRUE if a value is NOT within a specified range (inclusive).

Signatures

Returns: TRUE if expr lies in the inclusive range, or NULL if any argument is NULL

NOT_BETWEEN(expr: T, lower: T, upper: T, [digits: BIGINT]) → BOOLEAN
sql
ParameterTypeRequiredDescription
exprTYesValue to test
lowerTYesLower bound (inclusive)
upperTYesUpper bound (inclusive)
digitsBIGINTNoOptional decimal precision for numeric comparisons

Notes

  • Returns TRUE if expr < lower OR expr > upper
  • Range is inclusive of both bounds
  • NULL comparisons return NULL (three-valued logic)
  • Opposite of BETWEEN
  • All values must be of comparable types
  • For strings, uses lexicographic (dictionary) ordering
  • For dates, compares chronologically
  • For ARRAY and ROW, same ordering rules as BETWEEN

Related operators

Examples

NOT_BETWEEN — functional call

FeatureQL
SELECT
    f1 := NOT_BETWEEN(10, 1, 5), -- `NOT_BETWEEN(expr, lower, upper)` matches keyword `NOT BETWEEN … AND …`
    f2 := NOT_BETWEEN(3, 1, 5) -- Inside the inclusive range
;
Result
f1 BOOLEANf2 BOOLEAN
truefalse

NOT_BETWEEN — chained

FeatureQL
SELECT
    f1 := (10).NOT_BETWEEN(1, 5), -- Receiver is the value; arguments are lower and upper bounds
    f2 := (3).NOT_BETWEEN(1, 5) -- Same semantics as the prefix call
;
Result
f1 BOOLEANf2 BOOLEAN
truefalse

Last update at: 2026/05/26 17:22:09