数据库系统原理试卷(A)评分标准

2026/4/25 9:51:18

厦门大学《数据库系统原理》评分标准 信息科学技术学院计算机系2010年级计算机专业

主考教师:张东站 试卷类型:(A) 第一题

1、

2、

书籍(书号,名称,品种,数量,存放位置,出版社名) 出版社名为外键 出版社(出版社名,电报编号,电话,邮编,地址) 无外键 借书人(借书证号,姓名,单位)无外键

借阅(书号,借书证号,借书日期,还书日期) 书号和借书证号都是外键 其中下划线表示主键

(或把出版联系单独形成一个关系模式,即5个关系模式) 评分标准

ER图:每个实体0.5分(1.5分),实体属性各0.5分(7.5分),关联关系各1.5分(3分) 关系模式:主码0.5分(2.5分),外码0.5分(1.5分),关系名1分(4分)

第二题 1.(6%)

πAname,Mname(σC.Cname='Warner Bros'^R.Rtime>40(C∞M∞I∞A∞R)) 自然连接 1分选择1分投影1分

SELECT Mname,Aname FROM A,C,M,I,R

WHERE C.Cname='Warner Bros'and C.Cno=M.Cno andM.Mno=R.Mno and R.Rtime>40 and R.Ano=A.Ano

SELECT 语法1分条件2分

2.(4%)

πMname(σAname='Nicolas Cage'^Itime>’2013-06-01’^Itime<’2013-07-01’(A∞R∞M∞I)) 投影1分连接1分

SELECT M.Mname FROM M,A,I,R WHERE

A.Aname='Nicolas

Cage'and

A.Ano=R.AnoandI.Mno=R.Mnoand

I.Itime>'2013-06-01'and I.Itime<'2013-07-01'

SELECE语法 1分条件1分

3.(4%)

DELETEFROM I WHERE I.Itime<2013-01-01 and A.Aname='guomeimei'and A.Ano=R.Ano and R.Mno=I.Mno

DELETE 语法 2分条件2分

4.(4%)

UPDATE I

SET I.Iprice=I.Iprice*1.2

WHERE I.Mno=(select M.Mno from M where M.Cno=(select C.Cno from C where C.Cname='Warner Bros')

and I.Mno=(selectR.Mno fromRwhere A.Aname='Nicolas Cage' and A.Ano=R.Ano)

UPDATE 语法 2分条件 2分

5.(5%)

createview v as

select I.*from I,A

where A.Ano=I.Ano and I.Ano=(select Ano from A where Aname='Nicolas Cage')

grantselecton v to U1;

视图创建1分,正确选择 3分,授权1分

6.(7%)

declare @Mno varchar(30); declare @Mname varchar(30); declare @Aname varchar(30); declare @Mlength varchar(30); declare @Cname varchar(30); declare @Itime varchar(30); declare @Iprice int;

declare @NAname varchar(200); declare @string varchar(500); declare cur1 cursor for

select M.Mno,Mname,Mlength,Cname,Itime,Iprice from M,C,A,I,R where I.Itime>'2013-06-01'and I.Itime<'2013-07-01'and

M.Mno=I.Mno and M.Mno=R.Mno and I.Mno=R.Mno and C.Cno=M.Cno and A.Ano=R.Ano begin open cur1

fetch next from cur1 into @Mno,@Mname,@Mlength,@Cname,@Itime,@Iprice; while(@@fetch_status=0) begin

declare cur2 cursor for

select Aname from A,R where R.Mno=@Mno and R.Rtime>40 and R.Ano=A.Ano begin open cur2

fetch next from cur2 into @Aname set @NAname=@Aname; while(@@fetch_status=0) begin

set @NAname=@NAname+','+@Aname fetch next from cur2 into @Aname end

print @NAname close cur2 deallocate cur2 end set

@string=@Mname+'/'+@NAname+'/'+@Mlength+'/'+@Cname+'/'+@Itime+'/'+convert(cha

r(5),@Iprice); print @string

fetch next from cur1 into @Mno,@Mname,@Mlength,@Cname,@Itime,@Iprice; end

close cur1 deallocate cur1 end

7.(9%)

createproc adjustprice @date varchar(30), @companyname varchar(30) as

declare @Iprice int; declare @addprice int; declare @Ino varchar(30); declare @Mname varchar(30) declare @newprice int; declare cur cursor for

select Mname,Iprice,Ino from M,I,C where C.Cno in(select C.Cno from C where Cname=@companyname)

and I.Itime>@date and C.Cno=M.Cno and M.Mno=I.Mno orderby I.Itime begin open cur

fetch next from cur into @Mname,@Iprice,@Ino; while(@@fetch_status=0) begin

if(@Iprice<100) begin

set @addprice = @Iprice*0.2; end

elseif(@Iprice >=100) begin

set @addprice = @Iprice*0.1; end

update I set Iprice=@Iprice+@addprice where Ino=@Ino

set @newprice=(select Iprice from I where Ino=@Ino) print @Mname +'&'+convert(varchar(30),@newprice) fetch next from cur into @Mname,@Iprice,@Ino;


数据库系统原理试卷(A)评分标准.doc 将本文的Word文档下载到电脑
搜索更多关于: 数据库系统原理试卷(A)评分标准 的文档
相关推荐
相关阅读
× 游客快捷下载通道(下载后可以自由复制和排版)

下载本文档需要支付 10

支付方式:

开通VIP包月会员 特价:29元/月

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