贪吃鼠
贪吃鼠
全部文章
分类
题解(13)
归档
标签
去牛客网
登录
/
注册
贪吃鼠的博客
全部文章
(共13篇)
题解 | #计算25岁以上和以下的用户数量#
# 将用户划分为25岁以下和25岁及以上两个年龄段,分别查看这两个年龄段用户数量 # 注意:age 列存在空值,需要对空值进行处理 select '25岁及以上' age_cnt, count(1) Number from user_profile where ifnull(age, 0) >...
Mysql
2021-09-26
0
476
题解 | #查找山东大学男生的GPA#
# 查看学校为山东大学或者性别为男性的用户的device_id、gender、age和gpa数据,请取出相应结果,结果不去重 # 题目要求不去重,所以根据条件1:学校为山东大学,条件2:性别为男性,分别查询,最后将查询结果拼接起来 select device_id, gender, age,gpa ...
Mysql
2021-09-26
35
1111
题解 | #统计每个用户的平均刷题数#
# 仅查看山东大学的用户在不同难度下的每个用户的平均答题题目数情况 select university, difficult_level, count(q.question_id) / count(distinct q.device_id) from question_p...
Mysql
2021-09-26
0
330
题解 | #统计每个学校各难度的用户平均刷题数#
# 计算每个学校用户不同难度下的用户平均答题题目数情况 select university, difficult_level, count(q.question_id)/count(distinct u.device_id) from question_practice_...
Mysql
2021-09-26
0
407
题解 | #浙江大学用户题目回答情况#
# 查看所有来自浙江大学的用户题目回答明细情况 select device_id, question_id, result from question_practice_detail where device_id in ( select device_id fro...
Mysql
2021-09-26
0
347
题解 | #分组排序练习题#
# 查看不同大学的用户平均发帖情况,结果按照平均发帖情况进行升序排列 select university, avg(question_cnt) as avg_question_cnt from user_profile group by university order by av...
Mysql
2021-09-26
1
368
题解 | #分组过滤练习题#
# 取出平均发贴数低于5的学校或平均回帖数小于20的学校 select university, avg(question_cnt), avg(answer_cnt) from user_profile group by university having avg(ques...
Mysql
2021-09-26
0
359
题解 | #替换空格#
str.replace(old, new[, max])Python replace() 方法把字符串中的 old(旧字符串) 替换成 new(新字符串),如果指定第三个参数max,则替换不超过 max 次。 class Solution: def replaceSpace(self , s...
剑指offer
2021-09-07
0
376
题解 | #网易云音乐推荐#
一步一步拆解问题,最后组合起来。 查询user_id = 1 的用户,其关注的人(follower_id )select follower_id from follow where user_id = 1; 查询user_id = 1 的用户,其关注的人喜欢的音乐 (music_id)select...
SQL
数据分析
2021-08-27
84
4518
题解 | #实习广场投递简历分析(一)#
知识点: order by 后面可以跟聚合后的字段 cnt 日期为:在2025年内,使用 sbustr() 函数提取出日期字段的年份select job, sum(num) as cnt from resume_info where substr(date, 1, 4) = '2025' ...
SQL
2021-08-27
0
484
首页
上一页
1
2
下一页
末页