You are viewing an older version of this section. View current production version.
Join the SingleStore Community Today
Get expert advice, develop skills, and connect with others.

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

memsql> select abs(-9);
+---------+
| abs(-9) |
+---------+
|       9 |
+---------+

memsql> select abs(9);
+--------+
| abs(9) |
+--------+
|      9 |
+--------+

memsql> select abs(20-50);
+------------+
| abs(20-50) |
+------------+
|         30 |
+------------+