笨鹤稳飞
笨鹤稳飞
全部文章
题解
归档
标签
去牛客网
登录
/
注册
笨鹤稳飞的博客
全部文章
/ 题解
(共23篇)
题解 | #试卷完成数同比2020年的增长率及排名变化#
思路一: 分析: 既然最后只需要得到2020和2021年都有作答记录的tag, 不妨分别筛选出来2020年和2021年的数据再用join连接. 2020、2021各自的作答情况去对应的表中取即可 实现: select q1.tag, q1.exam_cnt as exam_cnt_20, q2.ex...
Mysql
2022-05-17
0
305
题解 | #每月及截止当月的答题情况#
思路一:新增月活判断标准:本月=首月 思路二:新增月活判断标准:本月在月份中的排序=1 方法一 分析 两次聚合窗口函数的分类标准不一致 新增月活判断标准:本月=首月——以uid分类,min()over 累计最大和累计总和:以start_month分类,max()over,sum()over() ...
Mysql
2022-05-17
1
426
题解 | #对试卷得分做min-max归一化#
易错点分析 1.初始(错误)代码 select uid,exam_id,round(avg(new_score),0) as avg_new_score from (select uid,er.exam_id, if(count(score)=1,score, 100...
Mysql
2022-05-17
0
248
题解 | SQL19#未完成试卷数大于1的有效用户#
关键点 2021年—— where year(start_time)=2021 未完成>1的有效用户(未完成<5+已完成>=1) 未完成——sum(if(submit_time is null,1,0))/count(if(submit_time is null,1,null...
Mysql
2022-04-27
0
327
题解 | SQL20 #月均完成试卷数不小于3的用户爱作答的类别#
分析: 筛选对象——“当月均完成试卷数”不小于3的用户们 当月均完成试卷数——总完成数/月份数(且是有完成情况的月份) Where submit_time is not null Count(exam_id)/count(distinct date_format(start_time,'%Y%m'...
Mysql
2022-04-27
2
382
题解 | SQL21 #试卷发布当天作答人数和平均分#
分析: SQL类别——where tag='SQL' 发布当天——date(release_time)=date(submit_time) 5级以上——where level>5 作答人数——count(distinct uid) as uv (desc) 平均分——avg(score)...
Mysql
2022-04-27
0
425
题解 | SQL23 #每个题目和每份试卷被作答的人数和次数#
我的稀碎答案 错因分析 select exam_id as tid,count(distinct uid) as uv, count(uid) as pv from exam_record group by tid order by uv desc,pv desc %%%哎呀呀 union all ...
Mysql
2022-04-27
2
394
题解 | SQL24 #分别满足两个活动的人#
分析初始错误答案 select uid, 'activity1' as activity from (select distinct uid,sum(if(score>=85,1,0)) as cnt1,count(uid) as cnt2 from exam_record group by...
Mysql
2022-04-27
0
308
题解 | SQL25 #满足条件的用户的试卷完成数和题目练习数#
分析: 筛选对象——“高难度SQL试卷得分平均值大于80并且是7级的红名大佬”: 筛选方式:where uid in (select uid from…) (一定是in单列表) 筛选语句: Where tag=‘SQL' and 'hard' and level=7 and score is n...
Mysql
2022-04-27
0
355
SQL26 每个6/7级用户的活跃情况(表的连接方式的选取)
我的稀碎答案 (错因分析及待改进的地方) select uid,count(distinct month0) as act_month_total, count(distinct if(substring(month0,1,4)=2021,date0,null)) as act_days_2021,...
Mysql
2022-04-27
0
342
首页
上一页
1
2
3
下一页
末页