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
Parameter | Type | Required | Description |
---|---|---|---|
value | T | Yes | Value to test |
lower_bound | T | Yes | Minimum value of range (inclusive) |
upper_bound | T | Yes | Maximum value of range (inclusive) |
digits | ANY | Yes | Optional 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