> [greater]

All functions > COMPARISON > > [greater]

Returns TRUE if the first value is strictly greater than the second value

Syntax

expr1 > expr2

Function form

Returns: TRUE or FALSE according to the comparison, or NULL if either operand is NULL

GREATER_THAN(expr1: T, expr2: T, [digits: BIGINT]) → BOOLEAN
sql
ParameterTypeRequiredDescription
expr1TYesFirst value to compare
expr2TYesSecond value to compare
digitsBIGINTNoDigits of rounded FLOAT/DOUBLE precision (.N); not applied when Inf or magnitude overflows DECIMAL(38, N) staging

Notes

  • Both values must be of comparable types
  • NULL comparisons always return NULL (three-valued logic)
  • For strings, uses lexicographic (dictionary) ordering
  • For dates/timestamps, later dates are "greater than" earlier dates
  • For ARRAY and ROW, ordering is lexicographic / field-by-field when types align
  • On FLOAT/DOUBLE, write .N (e.g. >.2, =.4, BETWEEN.3) for N decimal places of rounded precision via DECIMAL(38, N) staging, not N significant digits. Omitting .N uses 15 decimal places (DECIMAL(38, 15))
  • IN.N is the same suffix on membership
  • Any NaN operand makes the comparison NULL
  • Infinity, or any finite value too large for DECIMAL(38, N), falls back to a raw float compare — .N rounding is not applied on that path

Examples

› — typical comparisons

FeatureQL
RETURN
    -- Numeric
    f1 := 5 > 3,
    -- Strings
    f2 := 'zebra' > 'apple'
;
Result
f1 BOOLEANf2 BOOLEAN
truetrue

› — arrays and rows

FeatureQL
RETURN
    -- Lexicographic; longer can exceed when the prefix is equal
    f1 := ARRAY(1, 2, 3, 1) > ARRAY(1, 2, 3),
    -- Lexicographic; first difference decides
    f2 := ARRAY(1, 2, 3) > ARRAY(1., 2., 4.),
    -- Row field-by-field; integer/decimal may align per field
    f3 := ROW(2 AS a) > ROW(1. AS a)
;
Result
f1 BOOLEANf2 BOOLEANf3 BOOLEAN
truefalsetrue

› — three-valued logic

FeatureQL
RETURN
    -- NULL compared to value
    f1 := NULL::BIGINT > 0
;
Result
f1 BOOLEAN
NULL

GREATER_THAN — functional call

FeatureQL
RETURN
    -- `GREATER_THAN(expr1, expr2)` matches infix `>`
    f1 := GREATER_THAN(5, 3),
    -- False when the first value is not greater
    f2 := GREATER_THAN(1, 9)
;
Result
f1 BOOLEANf2 BOOLEAN
truefalse

GREATER_THAN — chained

FeatureQL
RETURN
    -- Dot form: receiver is the left-hand operand
    f1 := (5).GREATER_THAN(3),
    -- Same semantics as the prefix call
    f2 := (1).GREATER_THAN(9)
;
Result
f1 BOOLEANf2 BOOLEAN
truefalse