基础练习

select t3.university ,t4.difficult_level,

    count(t3.question_id)/count(distinct t3.device_id) as avg_answer_cnt

from (

    select t1.university,t2.question_id,t1.device_id

    from user_profile t1 right join question_practice_detail t2

    on t1.device_id=t2.device_id

    where t1.university='山东大学'

    )t3

inner join question_detail t4

on t3.question_id=t4.question_id

group by t3.university,t4.difficult_level;

先是内连接获取我想要的数据,变成一个表继续内连接,即子查询

全部评论
这里inner和right没区别
点赞 回复 分享
发布于 05-28 11:52 山东

相关推荐

05-28 16:58
已编辑
哈尔滨工业大学 Java
剑指延毕:你把自己当员工 人家把你当耗材 xd 身体第一
投递华为等公司8个岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务