笨鹤稳飞
笨鹤稳飞
全部文章
分类
题解(23)
归档
标签
去牛客网
登录
/
注册
笨鹤稳飞的博客
全部文章
(共28篇)
题解 | 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
SQL27 窗口函数的基础应用
分析我的稀碎答案: 妄图用Limit限制最终数据条数 (1) select tag as tid,uid, row_number() over (partition by tag order by tag,max(score) desc, min(score)...
Mysql
2022-04-27
0
848
SQL28 多个窗口函数的应用
思路分析: 找到第二快和第二慢用时之差大于试卷时长的一半的试卷信息,按试卷ID降序排序: 找到第二快和第二慢; 筛选出用时之差>试卷时长的一半的试卷 提取这些试卷的试卷信息并按试卷ID排序 具体分析——一步一表: 找到第二快和第二慢——应用两次窗口函数 row_number() ove...
Mysql
2022-04-27
1
325
SQL18 coalesce,union all
我的稀碎答案(也就是新手易错点): ①初级 select date_format(submit_time,'%Y%m') as submit_month, count(question_id) as month_q_cnt, count(question_id)/ daynumber from pr...
Mysql
2022-04-25
0
289
首页
上一页
1
2
3
下一页
末页