1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 15:18:01 +00:00
Files
til/postgres/special-math-operators.md
2015-07-11 08:28:38 -05:00

470 B

Special Math Operators

Postgres has all the mathematical operators you might expect in any programming language (e.g. +,-,*,/,%). It also has a few extras that you might not be expecting.

Factorial Operator:

> select 5!;
 ?column?
----------
      120
(1 row)

Square Root Operator:

> select |/81;
 ?column?
----------
        9
(1 row)

Absolute Value Operator:

> select @ -23.4;
 ?column?
----------
     23.4
(1 row)