首页 > 代码库 > MySQL 算术运算符

MySQL 算术运算符

(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 算术运算符