VeloDB Cloud
SQL Manual
Functions
math-functions
abs

abs

Description

Syntax:

DOUBLE abs(DOUBLE x) SMALLINT abs(TINYINT x) INT abs(SMALLINT x)

BIGINT abs(INT x) LARGEINT abs(BIGINT x) LARGEINT abs(LARGEINT x)

DOUBLE abs(DOUBLE x) FLOAT abs(FLOAT x) DECIMAL abs(DECIMAL x)

This function returns the absolute value of x.

Example

mysql> select abs(-2);
+---------+
| abs(-2) |
+---------+
|       2 |
+---------+
mysql> select abs(3.254655654);
+------------------+
| abs(3.254655654) |
+------------------+
|      3.254655654 |
+------------------+
mysql> select abs(-3254654236547654354654767);
+---------------------------------+
| abs(-3254654236547654354654767) |
+---------------------------------+
| 3254654236547654354654767       |
+---------------------------------+

Keywords

ABS