mysql sql 除法函数_SQL如何做除法

展开全部

SQL做除法的步骤:

select

t.[origin-destination],t.[SH/LANE/MOT] /(select count(1) from ['TMS$']) AS PERCENTAGEFROM (代码1) t

group by [origin-destination],t.[SH/LANE/MOT]

having t.[SH/LANE/MOT] /count(*) <= 0.01

注:两个count都是int,相除会没有小数部分,所以应该都给转32313133353236313431303231363533e4b893e5b19e31333431363639成带小数的数。

cast as numeric(10,4) 。

54965eaf201c681be9fc12541bea9dc4.png

扩展资料

例题,表明为chuqinqk   列名 迟到 1(次)一个月的总天数为30   求迟到率。

select * from table1 where 工资>2500 and 工资<3000 //同上

select 姓名 from table1 where 性别='0' and 工资='4000'

select * from table1 where not 工资= 3200

select * from table1 order by 工资desc //将工资按照降序排列

select * from table1 order by 工资 asc //将工资按照升序排列

select * from table1 where year(出身日期)=1987 //查询table1 中所有出身在1987的人select * from table1 where name like

'%张' /'%张%' /'张%' //查询1,首位字‘张’3,尾位字‘张’2,模糊查询

select * from table1 order by money desc //查询表1按照工资的降序排列表1 (升序为asc)

select * from table1 where brithday is null //查询表1 中出身日期为空的人

SQL语言,是结构化查询语言(Structured Query Language)的简称。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值