# Add, subtract, multiply or divide

Shape / columns

A variant of [Apply a maths function](https://meridian.online/operations/apply-a-maths-function).

Combine numbers with arithmetic operators such as plus, minus, times, divide and remainder.

Page: <https://meridian.online/operations/apply-a-maths-function/add-subtract-multiply-or-divide>

## Status

Runs as a SQL step.

arcform carries it as a `sql:` step today.

## The DuckDB step

add, subtract, multiply, divide and take the remainder

```sql
CREATE TEMP TABLE pairs AS SELECT * FROM (VALUES (1, 17, 5), (2, -17, 5), (3, 0, 5)) t(id, a, b);
CREATE TEMP TABLE result AS
SELECT id, a + b AS plus, a - b AS minus, a * b AS times, a / b AS divided, a // b AS whole, a % b AS remainder FROM pairs;
SELECT * FROM result ORDER BY id;
SELECT CASE WHEN ((SELECT [plus, minus, times, whole, remainder] FROM result WHERE id = 1) = [22, 12, 85, 3, 2] AND (SELECT divided FROM result WHERE id = 1) = 3.4 AND (SELECT [plus, minus, times, whole, remainder] FROM result WHERE id = 2) = [-12, -22, -85, -3, -2] AND (SELECT divided FROM result WHERE id = 2) = -3.4 AND (SELECT [plus, minus, times, whole, remainder] FROM result WHERE id = 3) = [5, -5, 0, 0, 0]) THEN 'as expected' ELSE error('the plus, minus, times, divide, whole-number divide and remainder of 17 and 5, and of -17 and 5, were not as expected') END AS verdict;
```

The statement builds its own data.

It needs nothing installed beyond DuckDB itself.

## What other tools call it

Meridian's classification; an independent blind rating agreed on 95.7% of 324 rows (variant, version 3).

- Azure Data Factory: [`Math functions`](https://learn.microsoft.com/en-us/azure/data-factory/control-flow-expression-language-functions) (read 2026-09-27)
- Apache DataFusion: [`Numerical Operators`](https://datafusion.apache.org/user-guide/sql/operators.html) (read 2026-09-27)
- Duckle: [`Modulo`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/website/docs/components.html) (read 2026-09-25)
- Ibis: [`Add`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/numeric.py) (read 2026-09-27)
- Ibis: [`Divide`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/numeric.py) (read 2026-09-27)
- Ibis: [`FloorDivide`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/numeric.py) (read 2026-09-27)
- Ibis: [`Modulus`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/numeric.py) (read 2026-09-27)
- Ibis: [`Multiply`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/numeric.py) (read 2026-09-27)
- Ibis: [`Negate`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/numeric.py) (read 2026-09-27)
- Ibis: [`Subtract`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/numeric.py) (read 2026-09-27)
- Apache NiFi: [`Math Functions`](https://nifi.apache.org/nifi-docs/record-path-guide.html) (read 2026-09-27)
- Apache NiFi: [`Mathematical Operations and Numeric Manipulation`](https://nifi.apache.org/nifi-docs/expression-language-guide.html) (read 2026-09-27)
- Polars: [`Expr operators: numeric (group)`](https://docs.pola.rs/api/python/stable/reference/expressions/operators.html) (read 2026-09-27)
- Trifacta: [`Numeric Operators`](https://help.alteryx.com/aac/en/trifacta-classic/wrangle-language/math-functions/numeric-operators.html) (read 2026-09-27)
