77范文网 - 专业文章范例文档资料分享平台

数据库系统基础教程第六章答案

来源:网络收集 时间:2019-04-23 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:或QQ: 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

数据库系统基础教程第六章答案

【篇一:数据库系统基础教程答案ch7】

>数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案

数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 数据库系统基础教程答案 7.1.1 a)

create table movies ( titlechar(100), yearint,

length int,

gee char(10),

studioname char(30), producerc# int,

primary key (title, year),

foreign key (producerc#) references movieexec(cert#) ); or

create table movies ( titlechar(100), yearint,

length int,

gee char(10),

studioname char(30),

producerc# int references movieexec(cert#), primary key (title, year) ); b)

create table movies ( titlechar(100), yearint,

length int,

gee char(10),

studioname char(30),

producerc# int references movieexec(cert#) on delete set null on update set null,

primary key (title, year) );

c)

create table movies ( titlechar(100), yearint,

length int,

gee char(10),

studioname char(30),

producerc# int references movieexec(cert#) on delete cascade on update cascade,

primary key (title, year) ); d)

create table starsin (

movietitle char(100)references movie(title), movieyear int,

starname char(30),

primary key (movietitle, movieyear, starname) ); e)

create table starsin (

movietitle char(100)references movie(title) on delete cascade, movieyear int,

starname char(30),

primary key (movietitle, movieyear, starname) );

7.1.2

to declare such a foreign-key constraint between the relations movie and starsin, values of the referencing attributes in movie should appear in moviestar as unique values. however, based on primary key declaration in relation starin, the uniqueness of movies is guaranteed with movietitle, movieyear, and starname attributes. even with title and year as referencing attributes there is no way of referencing unique movie from starsin

without starname information. therefore, such a constraint can not be expressed using a foreign-key constraint. 7.1.3

alter table product

add primary key (model);

alter table pc

add foreign key (model) references product (model); alter table laptop

add foreign key (model) references product(model); alter table printer

add foreign key (model) references product (model); 7.1.4

alter table classes

add primary key (class); alter table ships

add primary key (name); alter table ships

add foreign key (class) references classes (calss); alter table battles

add primary key (name); alter table outcomes

add foreign key (ship) references ships (name); alter table outcomes

add foreign key (battle) references battles (name); 7.1.5 a)

alter table ships

add foreign key (class) references classes (class) on delete set null on update set null;

in addition to the above declaration, class must be declared the primary key for classes. b)

alter table outcome

add foreign key (battle) references battles (name) on delete set null on update set null; c)

alter table outcomes

add foreign key (ship) references ships (name) on delete set null on update set null; 7.2.1 a)

yearint check (year = 1915)

b)

length int check (length = 60 and length = 250) c)

studioname char(30)

check (studioname in (?disney?, fox?, ?mgm?, ?paramount?) ) 7.2.2 a)

create table laptop ( …

speed decimal(4,2) check (speed = 2.0) … ); b)

create table printer ( …

type varchar(10)

check (type in (?laser?, ?ink-jet?, ?bubble-jet?)) … ); c)

create table product ( …

type varchar(10)

check (type in(?pc?, ?laptop?, ?printer?)) … ); d)

create table product ( …

model char(4)

check (model in (select model from pc union all

select model from laptop union all

select model from printer)) … );

* note this doesn?t check the attribute constraint violation caused by deletions from pc, laptop, or printer 7.2.3

百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库数据库系统基础教程第六章答案在线全文阅读。

数据库系统基础教程第六章答案.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.77cn.com.cn/wenku/zonghe/622412.html(转载请注明文章来源)
Copyright © 2008-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18
× 注册会员免费下载(下载后可以自由复制和排版)
注册会员下载
全站内容免费自由复制
注册会员下载
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: