- 类别:
数值函数 (舍入和截断)
ABS¶
返回数值表达式的绝对值。
语法¶
ABS( <num_expr> )
示例¶
SELECT column1, abs(column1)
FROM (values (0), (1), (-2), (3.5), (-4.5), (null));
+---------+--------------+
| COLUMN1 | ABS(COLUMN1) |
|---------+--------------|
| 0.0 | 0.0 |
| 1.0 | 1.0 |
| -2.0 | 2.0 |
| 3.5 | 3.5 |
| -4.5 | 4.5 |
| NULL | NULL |
+---------+--------------+