SelectDB Cloud
SQL 手册
函数
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)

返回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
© 2023 北京飞轮数据科技有限公司 京ICP备2022004029号 | Apache、Apache Doris 以及相关开源项目名称均为 Apache 基金会商标