D/MySQL

MySQL ABS()

yeon.Biju 2020. 3. 26. 18:59

ABS(X)

 

Returns the absolute value of X.

 

This function is safe to use with BIGINT values.

 

 

mysql> SELECT ABS(2) ;
+--------+
| ABS(2) |
+--------+
|      2 |
+--------+
1 row in set (0.25 sec)

mysql> SELECT ABS(-32) ;
+----------+
| ABS(-32) |
+----------+
|       32 |
+----------+
1 row in set (0.01 sec)