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     |

+------+--------+-------+-------+---------+-------+

select

banlinum.id,

banlinum.name,

banlinum.type,

banlinum.xiangmu,

banlinum.num,

xmcz.chanzhi_geshu,

(banlinum.num*xmcz.chanzhi_geshu) chanzhi

from xiangmu_chanzhi_biao xmcz,

(select pb.paiban_id id,

bl.shiji_shiyong_xingming name,

bl.yewu_leixing type,

bl.banli_yewu_one xiangmu,

count(bl.banli_yewu_one) num

from paiban_biao pb,banli_mingxi_biao blselect

banlinum.id,

banlinum.name,

banlinum.type,

banlinum.xiangmu,

banlinum.num,

xmcz.chanzhi_geshu,

(banlinum.num*xmcz.chanzhi_geshu) chanzhi

from xiangmu_chanzhi_biao xmcz,

(select pb.paiban_id id,

bl.shiji_shiyong_xingming name,

bl.yewu_leixing type,

bl.banli_yewu_one xiangmu,

count(bl.banli_yewu_one) num

from paiban_biao pb,banli_mingxi_biao bl

where pb.yidong_gonghao=bl.gong_hao

group by bl.banli_yewu_one,bl.shiji_shiyong_xingming

ORDER BY pb.paiban_id) banlinum

where banlinum.xiangmu=xmcz.banli_yewu

where pb.yidong_gonghao=bl.gong_hao

group by bl.banli_yewu_one,bl.shiji_shiyong_xingming

ORDER BY pb.paiban_id) banlinum

where banlinum.xiangmu=xmcz.banli_yewu

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值