首页
题库
公司真题
专项练习
面试题库
在线编程
面试
面试经验
AI 模拟面试
简历
求职
学习
课程
专栏·文章
竞赛
搜索
我要招人
发布职位
发布职位、邀约牛人
更多企业解决方案
在线笔面试、雇主品牌宣传
登录
/
注册
牛客987852806号
获赞
1116
粉丝
15
关注
4
看过 TA
424
北京北大方正软件技术学院
2011
运营
IP属地:北京
暂未填写个人简介
私信
关注
拉黑
举报
举报
确定要拉黑牛客987852806号吗?
发布(94)
刷题
牛客987852806号
2021-08-30 17:57
运营
题解 | #找出每个学校GPA最低的同学#
selectt.device_id,t.university,t.gpafrom(select *,dense_rank()over(partition by university order by gpa asc) as mfrom user_profile) as tWHEREt.m=1 窗口函数一目了然
0
点赞
评论
收藏
转发
牛客987852806号
2021-08-30 17:44
运营
题解 | #计算用户8月每天的练题数量#
selectDATE_FORMAT(date,'%e') as day,count(question_id)from question_practice_detailWHEREDATE_FORMAT(date,'%Y-%m')='2021-08'group by day DATE_FORMAT(date,'%Y-%m')='2021-08'筛选出八月份DATE_FORMAT(date,'%e') as day 在求出天,进行分组,聚合函数求出8月份每天练题次数
0
点赞
评论
收藏
转发
牛客987852806号
2021-08-30 17:39
运营
题解 | #查看不同年龄段的用户明细#
SELECTdevice_id,gender,case when age between 20 and 24 then '20-24岁'when age>=25 then '25岁以上' else '其他' end as age_cutfrom user_profile 考点 case when then当年龄在20-24之间,显示20-24岁case when age between 20 and 24 then '20-24岁'大于等于25,显示25岁以上when age>=25 then '25岁以上'剩下的数据就是其他else '其他' end
0
点赞
评论
收藏
转发
牛客987852806号
2021-08-30 17:26
运营
题解 | #统计每个用户的平均刷题数#
selectu1.university,q1.difficult_level,count(q.question_id)/count(distinct q.device_id)from user_profile u1 left join question_practice_detail q on u1.device_id=q.device_idleft join question_detail q1 on q1.question_id=q.question_idwhereu1.university='山东大学'group by u1.university,q1.difficult_level ...
0
点赞
评论
收藏
转发
牛客987852806号
2021-08-30 17:08
运营
题解 | #统计每个学校各难度的用户平均刷题数#
selectu.university,q1.difficult_level,count(q.question_id)/count(distinct q.device_id)from user_profile u inner join question_practice_detail q on u.device_id=q.device_idleft join question_detail q1 on q1.question_id=q.question_idgroup by u.university,q1.difficult_level 三表联,要求求出每个学校,每个难度的平均做题数 g...
0
点赞
评论
收藏
转发
牛客987852806号
2021-08-30 16:35
运营
题解 | #浙江大学用户题目回答情况#
selectu.device_id,q.question_id,q.resultfrom question_practice_detail q left join user_profile u on q.device_id=u.device_idwhereu.university='浙江大学' 思路 双标左联合或者内联应该都行,要什么就提取什么.
0
点赞
评论
收藏
转发
牛客987852806号
2021-08-30 16:24
运营
题解 | #分组排序练习题#
SELECTuniversity,AVG(question_cnt)from user_profilegroup by universityorder by avg(question_cnt) 题目 要求求出每个大学的发帖的平均值,所以,我们先用group by 分组大学,然后,求出发帖平均值avg(question_cnt) 在利用order by 进行排序即可
0
点赞
评论
收藏
转发
牛客987852806号
2021-08-30 16:19
运营
题解 | #分组过滤练习题#
SELECTuniversity,avg(question_cnt),avg(answer_cnt)from user_profilegroup by universityhaving avg(question_cnt)<5oravg(answer_cnt)<20 考点group by having按照大学进行分组 group by university,条件having avg(question_cnt)<5 or avg(answer_cnt)<20
0
点赞
评论
收藏
转发
牛客987852806号
2021-08-30 16:16
运营
题解 | #分组计算练习题#
SELECTgender,university,count(device_id),avg(active_days_within_30),avg(question_cnt)from user_profilegroup by university,gender
0
点赞
评论
收藏
转发
牛客987852806号
2021-08-30 16:06
运营
题解 | #计算男生人数以及平均GPA#
selectcount(gender),round(avg(gpa),1)from user_profileWHEREgender='male'group by gender 考点count聚合函数,avg平均值 group by 分组题目要求男性 where gender='male'要求算出男性的人数count(gender) group by gender 聚会函数必分组求出平均GPA 保留一位数四舍五入 round(avg(gpa),1)
0
点赞
评论
收藏
转发
牛客987852806号
2021-08-30 15:47
运营
题解 | #查找GPA最高值#
两种方法 where筛选 复旦大学条件,因最高的gpa,进行order by gpa desc降序,取第一行的数据即可select gpa from user_profileWHEREuniversity='复旦大学'order by gpa desc limit 1 2.where筛选 复旦大学条件,因最高的gpa,max(gpa)求出最大值也可selectmax(gpa )from user_profileWHEREuniversity='复旦大学'
0
点赞
评论
收藏
转发
牛客987852806号
2021-08-30 15:37
运营
题解 | #查看学校名称中含北京的用户#
selectdevice_id,age,universityfrom user_profileWHEREuniversity like '%北京%' 考点 like 相似like '%北京%'列名包括北京的字样like '北京%' 列名北京开头like '%北京' 列名北京结尾
0
点赞
评论
收藏
转发
牛客987852806号
2021-08-30 15:33
运营
题解 | #操作符混合运用#
selectdevice_id,gender,age,university,gpafrom user_profilewheredevice_id in (select device_id from user_profile where gpa>3.5 and university='山东大学')ordevice_id in (select device_id from user_profile where gpa>3.8 and university='复旦大学')复杂的写法,子查询的方式
0
点赞
评论
收藏
转发
牛客987852806号
2021-08-30 15:30
运营
题解 | #高级操作符练习(2)#
SELECTdevice_id,gender,age,university,gpafrom user_profilewheregpa>3.7oruniversity='北京大学'考点or 或者条件是为 gpa大于3.7 或者 学校为北大的gpa>3.7oruniversity='北京大学'
0
点赞
评论
收藏
转发
牛客987852806号
2021-08-30 15:21
运营
题解 | #高级操作符练习(1)#
selectdevice_id,gender,age,university,gpafrom user_profileWHEREgpa>3.5andgender='male' 考点 where and 连接条件gpa要大于3.5(gpa>3.5)andgender要等男性(gender='male')
0
点赞
评论
收藏
转发
1
2
3
4
5
6
7
工具箱
TA的圈子
暂未加入圈子
TA的圈子
TA的笔记
暂无笔记
TA的笔记
登录
0
天
已登录
0
天
连续登录
0
人
今日访客
牛客网
牛客企业服务