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

2019-04-23 12:03

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

【篇一:数据库系统基础教程答案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


数据库系统基础教程第六章答案.doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:新版会计结算业务知识习题库

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

马上注册会员

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