牛客666375956号
牛客666375956号
全部文章
分类
题解(56)
归档
标签
去牛客网
登录
/
注册
牛客666375956号的博客
全部文章
(共51篇)
题解 | #统计2021年10月每个退货率不大于0.5的商品各项指标#
1、计算每个指标所需要的参数 2、处理分母为0的情况,case when round((case when show_num=0 then 0 else click_num/show_num end),3)as ctr, 或者是 if(条件,是的值,否的值) round((if(show_num=...
Mysql
2022-02-13
0
306
题解 | #计算商城中2021年每月的GMV#
select date_format(event_time,"%Y-%m") as month,sum(case when `status`=2 then 0 else total_amount end)as GMV from tb_order_overall where year(event_ti...
Mysql
2022-02-13
0
299
题解 | #2021年11月每天的人均浏览文章时长#
理解题意 1、只需要2021年11月的 where date_format(in_time,"%Y%m)=2021-11 2、每天 group by 3、人均浏览 distinct uid 4、 文章时长 article_id !=0 SELECT dt,round(sum(ti)/count(di...
Mysql
2022-02-12
0
276
题解 | #近一个月发布的视频中热度最高的top3视频#
select video_id,round((100*playrate+5*likenum+3*commentnum+2*retweetnum)/(reno+1),0) as hot_index from( SELECT video_id,count(if(dur>=duration,end_...
Mysql
2022-02-12
0
202
题解 | #平均播放进度大于60%的视频类别#
select tag, concat(round(avg(if(TIMESTAMPDIFF(second,start_time,end_time)>=duration,1,TIMESTAMPDIFF(second,start_time,end_time)/duration))*100,2) ,...
Mysql
2022-02-11
2
541
题解 | #各个视频的平均完播率#
先计算播放时长,再筛选出大于等于总时长的 select video_id, round(count(case when interval_time>=duration then video_id else null end)/count(video_id),3)as avg_comp_play...
Mysql
2022-02-11
0
274
题解 | #0级用户高难度试卷的平均用时和平均得分#
SELECT uid,round(avg(case when score is not null then score else 0 end),0)as avg_score, round(avg(case when score is not null then TIMESTAMPDIFF(MINUT...
Mysql
2022-01-31
0
229
题解 | #统计有未完成状态的试卷的未完成数和未完成率#
SELECT exam_id,incomplete_cnt,round(incomplete_cnt/cnt,3) as incomplete_rate from(SELECT exam_id,count(*)as cnt,count(*)-count(score)as incomplete_cnt...
Mysql
2022-01-30
0
269
题解 | #试卷完成数同比2020年的增长率及排名变化#
select a.tag as tag,b.exam_cnt as exam_cnt_20,a.exam_cnt as exam_cnt_21, concat(round((a.exam_cnt-b.exam_cnt)/b.exam_cnt*100,1),'%') as growth_rate, b...
Mysql
2022-01-28
0
298
题解 | #每个6/7级用户活跃情况#
先找出50%的数据,再找出和匹配出6或7级的用户uid,最后利用dense_rank进行排序筛选出最近三个月的数据 SELECT uid,start_month,total_cnt,complete_cnt from( SELECT uid, date_format(start_time,'%Y%m...
Mysql
2022-01-28
0
360
首页
上一页
1
2
3
4
5
6
下一页
末页