1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-07 00:58:02 +00:00
Files
til/postgres/shorthand-absolute-value-operator.md

416 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)