Arithmetic
Pivot supports binary arithmetic on numeric expressions and limited interval arithmetic on dates and timestamps.
| Operator | Result |
|---|---|
| Addition | Sum of two values. |
| Subtraction | Difference between two values. |
| Multiplication | Product of two values. |
| Division | Floating-point quotient. |
Addition
Section titled “Addition”left_value + right_valueAdds two numeric values.
SELECT range + 2 AS result FROM range(1, 2);-- result: 3Subtraction
Section titled “Subtraction”left_value - right_valueSubtracts the right numeric value from the left.
SELECT range - 2 AS result FROM range(5, 6);-- result: 3Multiplication
Section titled “Multiplication”left_value * right_valueMultiplies two numeric values.
SELECT range * 3 AS result FROM range(2, 3);-- result: 6Division
Section titled “Division”left_value / right_valueReturns a floating-point quotient. Dividing two REAL values returns REAL;
other numeric pairs use DOUBLE.
SELECT range / 2 AS result FROM range(5, 6);-- result: 2.5Date and time arithmetic
Section titled “Date and time arithmetic”A DATE or TIMESTAMP can be adjusted by a constant INTERVAL.
SELECT ts + INTERVAL '1 hour' AS laterFROM (VALUES (TIMESTAMP '2026-09-09 12:00:00')) AS input(ts);-- later: 2026-09-09 13:00:00Month and year offsets are not supported. A DATE accepts only whole-day
offsets.
