Skip to content

11题的理解 #1

Description

@Common-zhou

朋友你好,11题我理解的是,找到有两门及以上不及格课程的同学的学号。之后求其平均成绩。所以我的sql如下,你认为哪个理解符合题意一点呢?

select s.SId, s.Sname, avg(sc2.score)
from Student s
         inner join (
    select sc.SId from SC sc where sc.score < 60 group by sc.SId having count(1) >= 2
) as failed_two on s.SId = failed_two.SId
         inner join SC sc2 on s.SId = sc2.SId
group by 1, 2;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions