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
ParameterTypeRequiredDescription
number1TYesNumber to subtract from
number2TYesNumber 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 BIGINTf2 BIGINTf3 BIGINTf4 BIGINT
70-65

Last update at: 2026/03/03 16:47:38
Last updated: 2026-03-03 16:48:19