NOT_BETWEEN

All functions > COMPARISON > NOT_BETWEEN

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

Syntax

NOT_BETWEEN(value: T, lower_bound: T, upper_bound: T) → BOOLEAN
sql

Type Parameters:

  • T: Comparable type (numeric, string, date, etc.)

Arguments

ParameterTypeRequiredDescription
valueTYesValue to test
lower_boundTYesMinimum value of range (inclusive)
upper_boundTYesMaximum value of range (inclusive)
digitsANYYesOptional decimal precision for numeric comparisons

Returns

BOOLEAN - TRUE if value is outside range, FALSE otherwise

Notes

  • Returns TRUE if value < lower_bound OR value > upper_bound
  • 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: 2025/10/13 10:23:46