以下是一些SQL算术运算符用法的简单示例 -
示例1 - 加法运算 -
mysql> select 10 + 20;
+-------+
| 10 + 20 |
+-------+
| 30 |
+-------+
1 row in set
示例2 - 乘法运算 -
mysql> select 10 * 20;
+---------+
| 10 * 20 |
+---------+
| 200 |
+---------+
1 row in set
示例3 - 除法运算 -
mysql> select 10 / 5;
+--------+
| 10 / 5 |
+--------+
| 2 |
+--------+
1 row in set
示例4 - 求余运算 -
mysql> select 14 % 5;
+---------+
| 14 % 5 |
+---------+
| 4 |
+---------+
1 row in set