+ [addition]
All functions > MATH > + [addition]
Adds two numeric values, or adds an interval to a date or timestamp.
Syntax
left + right · ADD(left, right)
Function form
Numeric addition: 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 typeBoth 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
Temporal addition: Timestamp after adding the interval
ADD(timestamp: TIMESTAMP, interval: INTERVAL) → TIMESTAMP sql
| Parameter | Type | Required | Description |
|---|---|---|---|
timestamp | TIMESTAMP | Yes | Timestamp to add to |
interval | INTERVAL | Yes | Interval to add |
- Adding an interval to a DATE or a TIMESTAMP returns TIMESTAMP
- Either order is accepted:
timestamp + intervalorinterval + timestamp, and the same for DATE - Returns NULL if either operand is NULL
Returns: Timestamp after adding the interval
ADD(date: DATE, interval: INTERVAL) → TIMESTAMP sql
| Parameter | Type | Required | Description |
|---|---|---|---|
date | DATE | Yes | Date to add to |
interval | INTERVAL | Yes | Interval to add |
Returns: Timestamp after adding the interval
ADD(interval: INTERVAL, timestamp: TIMESTAMP) → TIMESTAMP sql
| Parameter | Type | Required | Description |
|---|---|---|---|
interval | INTERVAL | Yes | Interval to add |
timestamp | TIMESTAMP | Yes | Timestamp to add to |
Returns: Timestamp after adding the interval
ADD(interval: INTERVAL, date: DATE) → TIMESTAMP sql
| Parameter | Type | Required | Description |
|---|---|---|---|
interval | INTERVAL | Yes | Interval to add |
date | DATE | Yes | Date to add to |
Notes
- Numeric addition requires compatible numeric types; returns NULL if either operand is NULL
- You can add an INTERVAL to a DATE or TIMESTAMP (and the symmetric interval-first form where the grammar allows it)
- Very large finite magnitudes can overflow when using floating-point types
Examples
+ — numeric
FeatureQL
RETURN
-- Basic addition
f1 := 1 + 2,
-- Right-hand side in parentheses
f2 := 10 + (-3)
;Result
| f1 BIGINT | f2 BIGINT |
|---|---|
| 3 | 7 |
+ — date and time
FeatureQL
RETURN
-- Timestamp plus interval
f1 := TIMESTAMP '2021-01-01' + INTERVAL '1 DAY'
;Result
| f1 TIMESTAMP |
|---|
| 2021-01-02T00:00:00 |
+ — floating-point
FeatureQL
RETURN
-- DOUBLE operands
f1 := 1.5e0 + 2.5e0
;Result
| f1 DECIMAL |
|---|
| 4.0 |
ADD(...)
FeatureQL
RETURN
-- Function call
f1 := ADD(1, 2)
;Result
| f1 BIGINT |
|---|
| 3 |
.ADD(...) — chained
FeatureQL
RETURN
-- Integer literal: wrap in parentheses so `.ADD` applies to the value, not to the digit sequence
f1 := (1).ADD(2),
-- Decimal base: chain without extra parentheses
f2 := 1.0.ADD(2),
-- Fold left via chained `.ADD`
f3 := (1).ADD(2).ADD(3)
;Result
| f1 BIGINT | f2 DECIMAL | f3 BIGINT |
|---|---|---|
| 3 | 3.0 | 6 |
ADD — Date and time
FeatureQL
RETURN
-- Chained add on a timestamp
f1 := TIMESTAMP '2021-01-01'.ADD(INTERVAL '1 DAY')
;Result
| f1 TIMESTAMP |
|---|
| 2021-01-02T00:00:00 |
ADD — Edge cases
FeatureQL
RETURN
-- Parsed duration
f1 := TIMESTAMP '2025-09-01 12:00:00'.ADD(
INTERVAL_PARSE('2 hours 30 minutes')
)
;Result
| f1 TIMESTAMP |
|---|
| 2025-09-01T14:30:00 |