MySQL abs()函數
ABS(X)
ABS()函數返回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)