ADD()
All functions > MATH > ADD()
Returns the sum of two numbers, or adds an interval to a date/timestamp.
Signatures
Numeric addition
Returns: Sum of the two numbers
ADD(number1: T, number2: T) → T sql
| Parameter | Type | Required | Description |
|---|---|---|---|
number1 | T | Yes | First number to add |
number2 | T | Yes | Second number to add |
With:
T: Any numeric type
Signature notes:
- Both arguments must be of the same numeric type
- Returns NULL if either operand is NULL
- Very large finite magnitudes can overflow when using floating-point types
Related operators
Examples
ADD(...)
FeatureQL
SELECT
f1 := ADD(1, 2) -- Function call
;Result
| f1 BIGINT |
|---|
| 3 |
.ADD(...) — chained
FeatureQL
SELECT
f1 := (1).ADD(2), -- Integer literal: wrap in parentheses so `.ADD` applies to the value, not to the digit sequence
f2 := 1.0.ADD(2), -- Decimal base: chain without extra parentheses
f3 := (1).ADD(2).ADD(3) -- Fold left via chained `.ADD`
;Result
| f1 BIGINT | f2 VARCHAR | f3 BIGINT |
|---|---|---|
| 3 | 3.0 | 6 |
Date and time
FeatureQL
SELECT
f1 := TIMESTAMP '2021-01-01'.ADD(INTERVAL '1 DAY'), -- Chained add on a timestamp
f2 := TIMESTAMP '2025-09-01 12:00:00'.ADD(INTERVAL_PARSE('2 hours 30 minutes')) -- Parsed duration
;Result
| f1 TIMESTAMP | f2 TIMESTAMP |
|---|---|
| 2021-01-02T00:00:00 | 2025-09-01T14:30:00 |
Edge cases
FeatureQL
SELECT
f1 := ADD(1.0, 2.0), -- DECIMAL addition
f2 := ADD(1E0, 2E0), -- DOUBLE addition
f3 := ADD(10, -3) -- Negative right operand
;Result
| f1 VARCHAR | f2 VARCHAR | f3 BIGINT |
|---|---|---|
| 3.0 | 3.0 | 7 |