cxone
cxone
全部文章
分类
题解(9)
归档
标签
去牛客网
登录
/
注册
cxone的博客
全部文章
(共26篇)
题解 | #筛选限定昵称成就值活跃日期的用户#
select uid,nick_name,achievement from user_info a where nick_name like'牛客%号' and achievement BETWEEN 1200...
Mysql
2022-08-04
0
267
题解 | #近三个月未完成试卷数为0的用户完成情况#
1、 dense_rank() 相同排序+连续 1,1,2,3 select uid,count(*) exam_complete_cnt from( select id,uid,exam_id,start_time,DATE_FORMAT(st...
Mysql
2022-08-03
0
205
题解 | #0级用户高难度试卷的平均用时和平均得分#
方法一 --- 明细层完成计算,然后再计算所有数值 select uid,round(SUM(score)/count(exam_id),0) avg_score,ROUND(SUM(timezone)/count(exam_id),1) avg_...
Mysql
2022-08-03
0
302
题解 | #第二快/慢用时之差大于试卷时长一半的试卷#
1、时间减法函数 TIMESTAMPDIFF(minute,时间1,时间2) minute不用引号 时间2-时间1用分钟表示 2、用rn排序之后,只有对应两个数值才有数值 用SUM和max一样 select exam_id,duration...
Mysql
2022-08-01
0
276
题解 | #每个6/7级用户活跃情况#
-- 2020算在整体数据中,计算2021 活跃度才计算 -- 不能使用 Year(DATE_FORMAT(now(),'%Y-%m'))=2021 变成字符串 -- 字符串转日期 str_to_date('2022-03-02','%Y-%m-%d') DATE(ca...
Mysql
2022-07-31
0
289
题解 | #满足条件的用户的试卷完成数和题目练习数#
1、注意distinct内容 count(distinct e.exam_id,e.submit_time) as exam_cnt , count(distinct p.question_id,p.submit_time) as question_cnt 有一个为null就不算 ...
Mysql
2022-07-31
0
276
题解 | #未完成试卷数大于1的有效用户#{重点}
select uid, count(case when score is null then 1 end) incomplete_cnt, count(case when score is not null then 1 end) complete_cnt, group_concat(d...
2022-07-24
0
179
题解 | #SQL类别高难度试卷得分的截断平均值#
-- 用开窗函数,去掉最大和最小 select tag,difficulty,round(AVG(score),1) clip_avg_score from( select tag,difficulty,score, row_number() over(order by score desc...
2022-07-22
0
238
题解 | #浙江大学用户题目回答情况#两种join和子查询
-- join两种写法 以及子查询 方法1: select qpd.device_id, qpd.question_id, qpd.result from question_practice_detail as qpd inner join user_profile as up on up.devi...
Mysql
2022-01-03
47
1532
题解 | #查找GPA最高值#两种方法max和倒序第一条
COUNT(【Shift+8】):统计表中元组个数; 方法一 select max(gpa) gpa from user_profile WHERE university='复旦大学' 方法二 select gpa from user_profile WHERE university='复旦大学...
Mysql
2022-01-02
6
595
首页
上一页
1
2
3
下一页
末页