% [remainder]
All functions > MATH > % [remainder]
Returns the remainder after dividing the left-hand number by the right-hand number.
Syntax
left % right · MODULO(left, right) · MOD(left, right)
Notes
- Supported for integer and DECIMAL types; both operands must be the same type
- The result has the same type as the operands; its sign follows the dividend
- Returns NULL if either operand is NULL
- Division by zero is an error
Related Functions
Examples
Modulo - remainder
FeatureQL
SELECT
f1 := 10 % 3, -- Basic modulo
f2 := 15 % 4 -- Non-zero remainder
;Result
| f1 BIGINT | f2 BIGINT |
|---|---|
| 1 | 3 |
Modulo - edge cases
FeatureQL
SELECT
f1 := -10 % 3, -- Sign follows dividend
f2 := 7 % 7 -- No remainder
;Result
| f1 BIGINT | f2 BIGINT |
|---|---|
| -1 | 0 |