在图书出版发行数据库系统中,有下列关系:
出版社(编号,名称,地址,邮政编码,电话号码,联系人),编号唯一,名称不能为空。
Create table publisher(
Id char(10) primary key,
Desc char(20) not null,
Addr char(30),
Zip char(8),
Phone char(20),
Contact char(20))
图书目录(书号,书名,作者,出版社编号,价格,出版日期),每本书的书号是唯一的,且书名、出版社编号、价格、出版日期均不为空且所有图书价格均不超过200元。
Create table books(
Isdn char(30) primary key,
Title char(20) not null,
Author char(20),
Price number(6,2) not null,
Pub_date datetime not null,
Pub_id char(10),
Check (price>0 and price<200),
Foreign key pub_id references publisher(id))
发行记录(记录号,书号,客户,数量,折扣率,金额),其中记录号为顺序编号,且唯一,书号、数量和金额不为空。
Create table pubRecord(
Sequence char(20) primary key,
Isdn char(30) not null,
Customer char(30),
Discount number(5,2),
Quantity integer not null,
Amount number(8,2) not null,
Foreign key isdn references books(isdn))
出自:湖南大学-计算机应用技术高本