< [less]

All functions > COMPARISON > < [less]

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

Syntax

expr1 < expr2

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, earlier dates are "less than" later dates
  • For ARRAY and ROW, ordering is lexicographic / field-by-field when types align
  • Supports optional decimal precision for numeric comparisons

Related Functions

Examples

< — typical comparisons

FeatureQL
SELECT
    -- Numeric strict order
    f1 := 1 < 2,
    -- Lexicographic strings
    f2 := 'apple' < 'banana',
    -- Dates
    f3 := DATE '2024-01-01' < DATE '2024-06-01'
;
Result
f1 BOOLEANf2 BOOLEANf3 BOOLEAN
truetruetrue

< — arrays and rows

FeatureQL
SELECT
    -- Lexicographic; first difference decides
    f1 := ARRAY(1, 2, 3) < ARRAY(1., 2., 4.),
    -- Shorter prefix can be less when shared elements match
    f2 := ARRAY(1, 2) < ARRAY(1., 2., 3.),
    -- Row field-by-field; integer/decimal may align per field
    f3 := ROW(1 AS a) < ROW(2. AS a)
;
Result
f1 BOOLEANf2 BOOLEANf3 BOOLEAN
truetruetrue

< — three-valued logic

FeatureQL
SELECT
    -- NULL on the left
    f1 := NULL::BIGINT < 1,
    -- NULL on the right
    f2 := 1 < NULL::BIGINT
;
Result
f1 BOOLEANf2 BOOLEAN
NULLNULL

Last update at: 2026/06/20 10:08:10