-
运算符说明
-
运算符用于减法运算。
语法结构
> SELECT value1-value2;
> SELECT column1-column2... FROM table_name;
示例
mysql> select 1123.2333-1233.3331;
+-----------------------+
| 1123.2333 - 1233.3331 |
+-----------------------+
| -110.09979999999996 |
+-----------------------+
1 row in set (0.00 sec)
create table t2(c1 int, c2 int);
insert into t2 values (-3, 2);
insert into t2 values (1, 2);
mysql> select c1-5 from t2;
+--------+
| c1 - 5 |
+--------+
| -8 |
| -4 |
+--------+
2 rows in set (0.00 sec)
mysql> select c1-c2 from t2;
+---------+
| c1 - c2 |
+---------+
| -5 |
| -1 |
+---------+
2 rows in set (0.01 sec)