--30
select Sno,Cno from SC
where Cno in(select s1.Cno from SC s1
group by s1.Cno having count(s1.Cno)>=2) order by Cno --31
select Sname,Sage from student where Sage in(select s1.Sage from student s1
group by s1.Sage having count(s1.Sage)>=2) order by Sage
--实验六
21
--32 select where from SC) --33
create table new_sc(Student_Name char(10),
Course_Name char(20), Grade smallint); insert into
new_sc(Student_Name,Course_Name,Grade)
22
Course.Cno,Cname Course.Cno=SC.Cno
from and
SC,Course
Course.Cno not in(select distinct Cno
select where null --34 select
Sname,Cname,Grade Course.Cno=SC.Cno
from and
SC,student,Course
SC.Sno=student.Sno and Grade is not
Sdept,Sname,Ssex,Cname,Grade from SC,student,Course where 系' union select
Sdept,Sname,Ssex,Cname,Grade from SC,student,Course where
Course.Cno=SC.Cno
and
SC.Sno=student.Sno and Sdept='计算
23
Course.Cno=SC.Cno and
SC.Sno=student.Sno and Sdept='信息
机系' --35 --(1)
select Sname,Sdept from student where Sno in(select Sno from SC where Cno='c01') --(2)
select Sno,Sname from student where Sdept='数学系' and Sno in(select Sno from SC
where Grade>80) --(3)
select Cname from Course where Cno in(select Cno from SC where Sno in(select Sno from student
where
24
Sdept='计算机系') ) --(4) select student
where Sno in(select top 3 with ties Sno from SC
where Cno in(select Cno from Course
where Cname='VB')
order by Grade desc ) --36
create table test(COL1 int,
COL2 char(10) not null,
COL3 char(10)
25
Sno,Sname,Sdept from