新浪数据分析笔试编程第三题AC分享

我最后提交的代码AC了,但是没有复制下来,这是中途在IDE写的,也修改了下,仅供参考。
select temp1.channel_type,round( (temp1.avgRead-temp2.avgRead)*1.0/temp2.avgRead,4) as escalate
from
(select channel_type,count(newsid)*1.0 / count(distinct A.uid) as avgRead
from user_read as A join new_user_info as B
on A.uid = B.uid
where new_dt = '2018-07-08' and dt = '20180708'
group by channel_type) as temp1
join
(select channel_type,count(newsid)*1.0 / count(distinct A.uid) as avgRead
from user_read as A join new_user_info as B
on A.uid = B.uid
where new_dt = '2018-07-07' and dt = '20180707'
group by channel_type) as temp2 on temp1.channel_type = temp2.channel.type
order by escalate

#新浪##笔试题目#
全部评论
啊,sorry,倒数第二行最后的temp2.channel.type应该是temp2.channel_type,但我提交时改了的。
点赞 回复 分享
发布于 2018-09-15 23:24
那你第二题A过了吗
点赞 回复 分享
发布于 2018-09-15 23:28
乘以1.0是因为?整数相除自动取整了?
点赞 回复 分享
发布于 2018-09-15 23:46
用户id忘了distinct😂😂耽误了20分钟😂一直报错
点赞 回复 分享
发布于 2018-09-15 23:53
想问楼主收到面试通知了吗
点赞 回复 分享
发布于 2018-09-30 17:05

相关推荐

01-23 14:54
同济大学 Java
热爱敲代码的程序媛:给你提几点【专业技能】这个模块里面可优化的地方:1.【具备JVM调优经验】可以去b站上搜一下JVM调优的视频,估计一两个小时凭你的学习能力就能掌握JVM调优的实践方面的技能。2.【MySql优化】MySql这一栏,你去b站或者找个博客看看MySql优化,学一下,如果你本身比较熟悉MySql语句的话,那基本半天时间凭你的学习能力MySql语句优化方面的技能你也能掌握个差不多。以上1,2两点主要是因为我看你专业技能大部分都说的是偏理论,没有写应用。再就是最后,你结合你的项目,想一想你的项目中哪些sql语句是可以用MySql优化的,到时候你面试的时候也好结合着说一下。
点赞 评论 收藏
分享
评论
点赞
24
分享

创作者周榜

更多
牛客网
牛客企业服务