自测题:
1、查询哪些课程没有人选修列出课程号和课程名;
[code]select cno,cname
from course
where cno not in(
select distinct cno
from sc)[/code]
2、用子查询实现如下查询:
(1)查询选修了1号课程的学生姓名和所在系;
[code]select sname,sno
from student
where sno in(
select sno
from sc
where cno=1)[/code]
(2)查询“数据库”成绩在80分以上的学生的学号和姓名;
[code]Select sno,sname
From student
Where sno in(
select sno
from course,sc
where course.cno=sc.cno and course.cname='数据库' and grade>=80)[/code](3)查询计算机系最高成绩。
[code]select top 1 grade
from student,sc
where student.sno=sc.sno and sdept='CS'
order by grade desc[/code]
3、查询同时选修了1号和2号课程的学生学号
[code]select sno
from sc
where cno=1 and sno in(
se