数据库编写 创建视图view2,查询所有学生的学号,姓名和平均成绩

2024-11-27 19:26:28
推荐回答(1个)
回答(1):

create view view2(sno,savg,sname)
as select Student.Sno,Sname,AVG((cast(StudentCourse.Grade as int)))
from Student join StudentCourse
on StudentCourse.Sno=Student.Sno
group by Student.Sno,Student.Sname
即可,反正Sno已经保证唯一了,再加上Sname也无法再干扰什么了。