Outdated Version
You are viewing an older version of this section. View current production version.
ABS
Returns the positive value of a given number, regardless of sign.
Syntax
ABS ( expression )
Arguments
- expression: any expression. This may be a column name, the result of another function, or a math operation.
Return Type
The absolute value of the expression.
Examples
select abs(-9);
+---------+
| abs(-9) |
+---------+
| 9 |
+---------+
select abs(9);
+--------+
| abs(9) |
+--------+
| 9 |
+--------+
select abs(20-50);
+------------+
| abs(20-50) |
+------------+
| 30 |
+------------+