✔检索选修课程包含LIU老师所授课程的学生学号
select sno
from sc
where cno in
(select cno
from c
where tname='LIU')
✔检索选修课程包含LIU老师所授全部课程的学生学号
select distinct sno
from sc X
where not exists
(select *
from sc y
where cno in
(select cno
from c
where tname='LIU')
and not exists
(select *
from sc z
where z.sno=x.sno and z.cno=x.cno)
)
■求LIU老师所授课程的每门课程的学生平均成绩
select sc.cno,AVG(grade)
from sc,c
where sc.cno=c.cno
and tname='LIU'
group by sc.cno
网友评论