数据库实验和参考答案(7)

2020-04-14 22:25

);

insert into test(COL1,COL2,COL3 ) values(null,'B2','');

insert into test(COL1,COL2,COL3 ) values(1,'B2','C2'); --37 --(1)

select Sname,Sdept,Cno,Grade into s1 from student,SC where --(2) create char(10),

st_sdept

26

student.Sno=SC.Sno and

Sname='计算机系' and Grade>80

table new_sc1(st_name

char(20),

sc_cno char(10),

sc_grade int);

insert into

new_sc1(st_name,st_sdept,sc_cno,sc_grade)

select Sname,Sdept,Cno,Grade from SC,student where --38

delete from SC where Grade<50 --39 --(1)

delete from SC where Grade<50 and

27

SC.Sno=student.Sno and

Sdept='计算机系' and Grade>80

Cno in(select Cno from Course

where Cname='信息系 ') --(2)

delete from SC from Course where SC.Cno=Course.Cno and Grade<80 and Cname='信息系 ' --40 update SC

set Grade=Grade+10 where Cno='c01' --41 --(1) update SC

set Grade=Grade+10

where Cno in(select Cno from Course where Cname='计算机应用') and Sno in(select Sno

28

from student where Sdept='计算机系') --(2) update SC

set Grade=Grade+10 from

Course,student

where and

Course.Cno=SC.Cno

SC.Sno=student.Sno and Cname='计算机应用'and Sdept='计算机系' --42

create view stv1 as

select student.Sno,Sname,Sage from student,SC,Course where

Course.Cno=SC.Cno

and

SC.Sno=student.Sno and Sdept='计算机系' and Cname='数据库基础 ' --43

29

create view stv2 as

select * from student where Sdept='计算机系' --44

select Sname from student,SC,Course where

Course.Cno=SC.Cno

and

SC.Sno=student.Sno and Sdept='信息系' and Cname='数据库基础 ' and Grade>80 --45

drop view stv1 --46 update stv2 set Sage=Sage+1 where Sdept='计算机系' --47

select Sname from student

30


数据库实验和参考答案(7).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:掘进队班组建设制度汇编

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: