题解 | #月均完成试卷数不小于3的用户爱作答的类别#

月均完成试卷数不小于3的用户爱作答的类别

https://www.nowcoder.com/practice/b1d13efcfa0c4ecea517afbdb9090845

select ei.tag,count(er.start_time) cnt from exam_record er,examination_info ei
where er.exam_id=ei.exam_id
and er.uid in(
select a.uid from exam_record a
where a.submit_time is not null
group by a.uid
having (count(a.exam_id)/count(distinct substr(a.submit_time,1,7)))>=3
)
group by ei.tag
order by cnt desc

1.先求出月均完成试卷数的uid

2.在根据uid取关联求出课程对应的课程次数

也许这个不是最优解,如果您有更好的办法,欢迎留言解答

#oracle#
全部评论

相关推荐

09-26 19:45
门头沟学院 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务