用SQL语句查询所有学生(包括未选课的学生)的学号、姓名(SName)、该学生所选课程的平均分。提示:用外

2024-12-02 14:17:13
推荐回答(3个)
回答1:

SELECT 学号 = S.SNo,
姓名 = SName,
平均分 = AVG(Score)
FROM Student S
LEFT OUTER JOIN SC
ON S.SNo=SC.SNo
GROUP BY S.SNo,SName

回答2:

select sno,sname,avg(score) from sc,student
where sc.sno=student.sno order by sno;

回答3:

select sno,sname,avg(score) from sc,student where sc.sno=student.sno order by sname;