SQL/MySQL/Math/ABS

Материал из SQL эксперт
Перейти к: навигация, поиск

Abstract value demo

/*
mysql> select ABS(0);
+--------+
| ABS(0) |
+--------+
|      0 |
+--------+
1 row in set (0.00 sec)
mysql> select ABS(-1);
+---------+
| ABS(-1) |
+---------+
|       1 |
+---------+
1 row in set (0.00 sec)
mysql> select ABS(1);
+--------+
| ABS(1) |
+--------+
|      1 |
+--------+
1 row in set (0.01 sec)

*/  
select ABS(0);
select ABS(-1);
select ABS(1);



Use ABS 2

/*
mysql> select ABS(-4.05022);
+---------------+
| ABS(-4.05022) |
+---------------+
|       4.05022 |
+---------------+
1 row in set (0.01 sec)

*/
select ABS(-4.05022);