Arithmetic addition operator +
Last updated: 2026-11-04
Arithmetic addition operator +
The addition operator + sums two numeric operands and is the most basic arithmetic operation in SQL. It works on integer, numeric, bigint, money and other numeric types, and the result is NULL whenever either operand is NULL. There is no string addition in PostgreSQL; use the || operator for text concatenation.
| Kind | operator |
|---|---|
| Example Language | SQL |
📝 Syntax
a + b
Precedence, highest to lowest: `.`/`::`/`[]` > unary `+ -` > `^` > `* / %` > binary `+ -` > all other operators (including `||`) > `BETWEEN`/`IN`/`LIKE` > comparison `< > = <= >= <>` > `IS NULL`/`IS TRUE` > `NOT` > `AND` > `OR`. Binary `+`/`-` at the same level are left-associative, so `10 - 3 - 2` is 5.
⚙️ Parameters
| a | Left operand, any numeric type; if NULL the whole expression evaluates to NULL. |
|---|---|
| b | Right operand, any numeric type; if NULL the whole expression evaluates to NULL. |
Returns:A numeric type matching the operands; NULL if either operand is NULL.
▶ Example
Runs real PostgreSQL 18 right in your browser (PGlite WASM, nothing to install). Press ▶ Run and the result appears in the panel below.
Output:
SELECT id, a + b AS sum FROM t_plus ORDER BY id
id | sum
---+-----
1 | 13
2 | NULL
3 | 1
(3 rows)
SELECT a + b IS NULL AS null_is_absent FROM t_plus WHERE id = 2
null_is_absent
--------------
true
(1 row)
📌 Key Points
- NULL propagation: if either operand is NULL the result is NULL; NULL is never treated as 0.
- Unary minus binds tighter than `^` in PostgreSQL, so `-2^2` is 4 — this differs from some other databases.
- Use `||` for text concatenation; `+` accepts numeric types only.
💡 Related Cases
More case studies coming soon.
📚 Related Reference
❓ FAQ
QWhy is 10 + NULL not 10?
ANULL means "unknown", not 0. Adding an unknown value to 10 is still unknown, so the result is NULL.