SUBTRACT
All functions > MATH > SUBTRACT
Returns the result of the subtraction of the second number from the first.
Signatures
Numeric subtraction
Returns: the result of the subtraction
SUBTRACT(number1: T, number2: T) → T sql
| Parameter | Type | Required | Description |
|---|---|---|---|
number1 | T | Yes | Number to subtract from |
number2 | T | Yes | Number to subtract |
With:
T: Any numeric type
Notes
- Both arguments must be of the same numeric type
- Returns NULL if either operand is NULL
- Order matters:
SUBTRACT(a, b)≠SUBTRACT(b, a) - Operator form:
number1 - number2
See also
Examples
FeatureQL
SELECT
f1 := SUBTRACT(10, 3), -- Basic subtraction
f2 := SUBTRACT(5, 5), -- Equal numbers
f3 := SUBTRACT(1, 7), -- Negative result
f4 := SUBTRACT(0, -5) -- Subtracting negative
;Result
| f1 BIGINT | f2 BIGINT | f3 BIGINT | f4 BIGINT |
|---|---|---|---|
| 7 | 0 | -6 | 5 |
On this page