首页
题库
公司真题
专项练习
面试题库
在线编程
面试
面试经验
AI 模拟面试
简历
求职
学习
基础学习课
实战项目课
求职辅导课
专栏&文章
竞赛
我要招人
发布职位
发布职位、邀约牛人
更多企业解决方案
AI面试、笔试、校招、雇品
HR免费试用AI面试
最新面试提效必备
登录
/
注册
垫底菜鸡
获赞
81
粉丝
9
关注
0
看过 TA
456
武汉大学
2022
算法工程师
IP属地:浙江
暂未填写个人简介
私信
关注
拉黑
举报
举报
确定要拉黑垫底菜鸡吗?
发布(63)
评论
刷题
收藏
垫底菜鸡
关注TA,不错过内容更新
关注
2023-03-04 12:09
武汉大学 算法工程师
题解 | #浙大不同难度题目的正确率#
select qd.difficult_level, #正确率是答正确的题/总题数 sum(if(result='right',1,0))/count(qpd.question_id) as correct_rate from user_profile as up inner join question_practice_detail as qpd on up.device_id = qpd.device_id and up.university = '浙江大学' inner join question_detail as qd on qpd.question_id = qd.question...
0
点赞
评论
收藏
分享
2023-03-04 11:40
武汉大学 算法工程师
题解 | #统计复旦用户8月练题情况#
select up.device_id,up.university, count(qpd.question_id) as question_cnt, sum(if(qpd.result='right',1,0)) as right_question_cut from user_profile as up left join question_practice_detail as qpd on up.device_id = qpd.device_id and month(qpd.date)=8 where up.university ='复旦大学' group by up.device_id 新...
0
点赞
评论
收藏
分享
2023-03-03 20:12
武汉大学 算法工程师
题解 | #找出每个学校GPA最低的同学#
select device_id,university,gpa from user_profile where (university,gpa) in (select university,min(gpa) from user_profile group by university) order by university #说是对不上,所以需要子查询 #这里是用子查询来做的 子查询很重要
0
点赞
评论
收藏
分享
2023-03-03 19:58
武汉大学 算法工程师
题解 | #截取出年龄#
select substring_index(substring_index(profile,',',3),',',-1) as age, count(device_id) as number from user_submit group by age 老是漏写,
0
点赞
评论
收藏
分享
2023-03-03 19:40
武汉大学 算法工程师
题解 | #提取博客URL中的用户名#
select device_id, substring_index(blog_url,'/',-1) from user_submit #group by device_id 有聚合函数的情况下才需要group by
0
点赞
评论
收藏
分享
2023-03-03 19:05
武汉大学 算法工程师
题解 | #统计每种性别的人数#
select substring_index(profile,',',-1) as gender, count(device_id) as number from user_submit group by gender group by和count(device_id)确实是没有想到的
0
点赞
评论
收藏
分享
2023-03-03 17:05
武汉大学 算法工程师
题解 | #计算用户的平均次日留存率#
select count(date2) / count(date1) as avg_ret from ( select distinct qpd.device_id, qpd.date as date1, uniq_id_date.date as date2 from question_practice_detail as qpd left join( select distinct device_id, date from question_practice_detail ) as uniq_id_date on qpd.device_id=uniq_id_date.device_id an...
0
点赞
评论
收藏
分享
2023-03-03 16:49
武汉大学 算法工程师
题解 | #计算用户8月每天的练题数量#
select day(date) as day, count(question_id) as question_cnt from question_practice_detail where month(date) = 8 and year(date) = 2021 group by date 一遇上日期的题,直直觉的自己不行,几乎下意识就放弃了
0
点赞
评论
收藏
分享
2023-03-03 16:32
武汉大学 算法工程师
题解 | #计算25岁以上和以下的用户数量#
SELECT Case When age < 25 or age is null then '25岁以下' When age >= 25 then '25岁及以上' End age_cut,count(*)number from user_profile group by age_cut 虽然想到了case when,但是具体怎么运用还是不太清楚
0
点赞
评论
收藏
分享
2023-03-02 18:03
武汉大学 算法工程师
题解 | #分组过滤练习题#
SELECT university, avg(question_cnt) as avg_question_cnt, avg(answer_cnt) as avg_answer_cnt from user_profile group by university having avg_question_cnt<5 or avg_answer_cnt<20 having是这样子用的,当时整理知识点的时候不怎么明白,现在实际运用稍微明白了一点点了
0
点赞
评论
收藏
分享
2023-03-02 17:54
武汉大学 算法工程师
题解 | #分组计算练习题#
Select gender,university, count(device_id) as user_num, avg(active_days_within_30) as avg_active_days, avg(question_cnt) as avg_question_cnt from user_profile group by gender,university count(device_id)这一点没有想到,group by可以单独使用,我一直试图在where后面添加group by,所以一直失败。这道题挺难的
0
点赞
评论
收藏
分享
2023-03-02 17:24
武汉大学 算法工程师
题解 | #计算男生人数以及平均GPA#
SELECT count(gender) as male_num,avg(gpa) as avg_gpa from user_profile where gender = 'male' 像这样聚合函数和聚合函数之间用,隔开,不要用and
0
点赞
评论
收藏
分享
2023-03-02 17:17
武汉大学 算法工程师
题解 | #查找GPA最高值#
Select round(max(gpa),1) from user_profile where university = '复旦大学' 没能想到聚合函数
0
点赞
评论
收藏
分享
2023-03-02 17:14
武汉大学 算法工程师
题解 | #查看学校名称中含北京的用户#
select device_id,age,university from user_profile where university like ('北京%') 虽然可以想到like,但是后续的%还是看了题解
0
点赞
评论
收藏
分享
2023-03-02 17:11
武汉大学 算法工程师
题解 | #操作符混合运用#
SELECT device_id,gender,age,university,gpa from user_profile where (gpa>3.5 and university in ('山东大学') ) or (gpa>3.8 and university in ('复旦大学')) 写的复杂了些,不过可以用
0
点赞
评论
收藏
分享
1
2
3
4
5
创作者周榜
更多
关注他的用户也关注了:
牛客网
牛客网在线编程
牛客网题解
牛客企业服务