MySQL ABS 函数
-
定义和用法
ABS - 返回绝对值。 -
语法
ABS(X)
函数返回X的绝对值。请考虑以下示例 -
示例
尝试一下mysql> SELECT ABS(2); +---------------------------------------------------------+ | ABS(2) | +---------------------------------------------------------+ | 2 | +---------------------------------------------------------+ 1 row in set (0.00 sec) mysql> SELECT ABS(-2); +---------------------------------------------------------+ | ABS(2) | +---------------------------------------------------------+ | 2 | +---------------------------------------------------------+ 1 row in set (0.00 sec)