NOT_BETWEEN

All functions > COMPARISON > NOT_BETWEEN

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

Signatures

Returns: TRUE if expr is not within the range, FALSE otherwise, NULL if any value is NULL

NOT_BETWEEN(expr: T, lower: T, upper: T, [digits: BIGINT]) → BOOLEAN
sql
ParameterTypeRequiredDescription
exprTYesExpression to test
lowerTYesMinimum value of the range (inclusive)
upperTYesMaximum value of the range (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 function
  • All values must be of comparable types
  • For strings, uses lexicographic (dictionary) ordering
  • For dates, compares chronologically
  • Can use operator syntax: value NOT BETWEEN lower_bound AND upper_bound
Last update at: 2026/03/03 16:47:38
Last updated: 2026-03-03 16:48:19