1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 15:18:01 +00:00
Files
til/postgres/shorthand-absolute-value-operator.md
2020-07-14 19:36:18 -05:00

507 B

Shorthand Absolute Value Operator

Postgres offers many math functions including abs for computing the absolute value of a number.

> select abs(-1);
 abs
-----
   1
(1 row)

There is also an absolute value operator -- the @ symbol. This can be used to do the same thing.

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

source