Return the absolute value of a number
SELECT ABS(2); -> 2
SELECT ABS(-46); -> 46
The sign
of a number compares it to 0.
Sign | Result | Example |
---|---|---|
-1 | n < 0 | SELECT SIGN(42); -> 1 |
0 | n = 0 | SELECT SIGN(0); -> 0 |
1 | n > 0 | SELECT SIGN(-3); -> -1 |
SELECT SIGN(-423421); -> -1