1. 程式人生 > >MySQL 算術運算符

MySQL 算術運算符

算術運算 lec nbsp ins 算術運算符 lin int 求余 microsoft

(1) + :加法運算
(2) - :減法運算
(3) * :乘法運算
(4) / :除法運算,返回商
(5) % :求余運算,返回余數

mysql> CREATE TABLE tmp14 ( num INT ) ;

mysql> INSERT INTO tmp14 VALUE(64);

mysql> SELECT num, num+10, num-3, num*3, num/3, num%3 FROM tmp14;
+------+--------+-------+-------+---------+-------+
| num | num+10 | num-3 | num*3 | num/3 | num%3 |


+------+--------+-------+-------+---------+-------+
| 64 | 74 | 61 | 192 | 21.3333 | 1 |
+------+--------+-------+-------+---------+-------+

MySQL 算術運算符