< [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
f1 := 1 < 2, -- Numeric strict order
f2 := 'apple' < 'banana', -- Lexicographic strings
f3 := DATE '2024-01-01' < DATE '2024-06-01' -- Dates
;Result
| f1 BOOLEAN | f2 BOOLEAN | f3 BOOLEAN |
|---|---|---|
| true | true | true |
< — arrays and rows
FeatureQL
SELECT
f1 := ARRAY(1, 2, 3) < ARRAY(1., 2., 4.), -- Lexicographic; first difference decides
f2 := ARRAY(1, 2) < ARRAY(1., 2., 3.), -- Shorter prefix can be less when shared elements match
f3 := ROW(1 AS a) < ROW(2. AS a) -- Row field-by-field; integer/decimal may align per field
;Result
| f1 BOOLEAN | f2 BOOLEAN | f3 BOOLEAN |
|---|---|---|
| true | true | true |
< — three-valued logic
FeatureQL
SELECT
f1 := NULL::BIGINT < 1, -- NULL on the left
f2 := 1 < NULL::BIGINT -- NULL on the right
;Result
| f1 BOOLEAN | f2 BOOLEAN |
|---|---|
| NULL | NULL |