ER图2关系模型:九步转换算法

合集下载

数据库设计中的ER模型与关系模型转换实战教程

数据库设计中的ER模型与关系模型转换实战教程

数据库设计中的ER模型与关系模型转换实战教程数据库设计是构建和管理现代软件系统的关键组成部分。

在设计数据库时,ER(实体关系)模型和关系模型是两种常用的方法。

ER模型为我们提供了一种图形化的方式来表示系统中存在的实体、实体间的关系和属性。

而关系模型则是以表格的形式来表示这些实体、关系和属性。

本文将介绍如何将ER模型转换为关系模型的实际步骤。

1. 分析需求在开始转换ER模型为关系模型之前,首先需要对数据库的需求进行详细的分析。

这包括确定系统中存在的实体、实体间的关系以及它们各自的属性。

2. 标识实体根据需求分析,将每个实体标识出来。

实体可以是现实世界中的对象、人或组织,也可以是抽象的概念。

3. 标识属性对于每个实体,确定其属性。

属性是实体的特征或描述,可分为主属性和次属性。

主属性是唯一标识实体的属性,次属性则是描述实体的其他属性。

4. 确定关系确定每个实体间的关系。

关系可以是一对一、一对多或多对多的。

一对一关系表示两个实体之间存在唯一的联系;一对多关系表示一个实体可以对应多个实体;多对多关系表示多个实体之间存在多个联系。

5. 构建ER模型根据上述分析结果,使用实体关系图(ER图)工具,如UML或ERWin,构建ER模型。

ER模型由实体、关系和属性构成的图形化表示。

6. 转换关系模型将ER模型转换为关系模型的过程也称为规范化。

关系模型是以表格的形式表示实体、关系和属性的。

7. 创建表格根据ER模型中的实体和属性,为每个实体创建一个表格,并将每个属性作为表格中的列。

8. 确定主键为每个表格确定主键。

主键是能够唯一标识表格中每个记录的属性。

常见的主键类型包括单一属性主键、复合主键和自增主键。

9. 连接关系将ER模型中的关系转换为关系模型中的外键。

外键是一个属性,它引用了其他表格中的主键。

10. 创建索引根据查询需求确定要创建的索引。

索引可以加快数据的检索速度。

11. 规范化数据库对数据库进行规范化是优化数据库设计的一种重要方法。

ER模型转换为关系模型规则

ER模型转换为关系模型规则

ER模型转换为关系模型规则
转换规则如下:
1.实体转换为关系表:
将ER模型中的每个实体转换为一张关系表。

每个实体的属性对应关系表的列。

2.属性转换为关系表的列:
实体的属性被转换为关系表的列,属性的名称作为列名,属性的数据类型作为列的数据类型。

3.主键属性:
如果一个实体的属性被定义为主键,那么这个属性将成为关系表的主键。

4.外键属性:
5.一对一关系:
如果两个实体之间的关系是一对一的,那么可以在任意一个实体的关系表中增加对方实体的主键,作为外键。

6.一对多关系:
如果两个实体之间的关系是一对多的,那么可以在多的一方实体的关系表中增加一的一方实体的主键,作为外键。

7.多对多关系:
如果两个实体之间的关系是多对多的,那么需要创建一个中间表来表示这种关系。

中间表中的每一行记录表示两个实体之间的关系,而关系的属性则作为中间表的列。

在完成ER模型到关系模型的转换后,可以通过对关系表进行插入、更新、删除等操作来操作数据。

同时,可以通过关系表的连接操作来获取两个实体之间的关系。

关系模型的优势在于它能够提供简单且强大的数据操作方式,同时保证数据的完整性和一致性。

概念模型ER图及概念模型转化成关系模型

概念模型ER图及概念模型转化成关系模型

m
n
1
办卡
属于
1 学生卡
1 班级
课程号 课程名
学分
卡号
余额
班号
辅导员
二、概念模型转化成逻辑模型
将E-R图转换为关系模型实际是将实体集、 属性以及联系转换为相应的关系模式, 1.实体集的转换规则:概念模型中的一个 实体集转换为关系模型中的一个关系,实 体的属性就是关系的属性,实体的码就是 关系的码,关系的结构是关系模式,
较强的语义表达能力,能够方便、直接地表达应用中的 各种语义知识
简单、清晰、易于用户理解,
2. 信息世界中的基本概念
1 实体 Entity
客观存在并可相互区别的事物称为实体,
可以是具体的人、事、物或抽象的概念,
2 属性 Attribute
实体所具有的某一特性称为属性, 一个实体可以由若干个属性来刻画,
3. 概念模型的表示方法ER图
实体型
用矩形表示,矩形框内写明实体名,
学生
教师
E-R图 续
An Introduction to Database System
属性
用椭圆形表示,并用无向边将其与相应的实体连 接起来
学生
学号
姓名
性别
年龄
E-R图 续
An Introduction to Database System
2. 实体集间联系的转换规则
以下举例基于以下的E-R图
成绩
选课 n 课程
学号
姓名
学生
m
n
1
办卡
属于
1 学生卡
1 班级
课程号 课程名
学分
卡号
余额
班号
辅导员
An Introduction to Database System

如何将ER图转化为关系模型(超详细、含例题)

如何将ER图转化为关系模型(超详细、含例题)

如何把ER模型转换为关系模型这是数据库工程设计进行到逻辑设计的一重大环节,简单的说,如果概念设计是用ER模型,整合为全局的ER模型,那么在逻辑设计这块,主要任务就是把ER模型转换为关系模型。

转换只需知道三个转换准则:1:1遇到1:1 关系的话在两个实体任选一个添加另一个实体的主键即可。

1:N1:N 遇到1:N 关系的话在N端添加另一端的主键,假如有学生和班级两个实体,一个班级可以容纳多个学生,但是一个学生只能选择一个班级,因此班级和学生是1:N的关系,现在要转换为关系模型,我们只需在学生的这端加上班级的唯一标识即可,这样做的原因是,因为一个学生只能有一个班级,班级是相对学生唯一的。

N:M遇到N:M我们需要将联系转换为实体,然后在该实体上加上另外两个实体的主键,作为联系实体的主键,然后再加上该联系自身带的属性即可。

例如有学生和老师两个实体,一个学生可以由多名老师来授课,一名老师也可以授课多名学生,它们是M:N关系的,假如联系为授课,该联系上有成绩属性,因此当我们把它转换为关系模型时,我们把联系转换为联系实体,并添加学生实体的主键(学号)和教师实体的主键(教师编号)作为自己的主键,值得注意的是,授课实体的外键分别是学号和教师编号,但是它的主键是(学号,教师编号),另外它还拥有自己的一个属性成绩。

1:1:N这是三元联系的对应关系,但是当转换为关系模型时,和1:N的情况是差不多的。

我们只需将N端添加另外两端的主键即可。

M:N:P这种三元联系的三种多对应关系,看上去很复杂,其实转换起来并不是那么复杂了,我们要做的仅仅是将其中的联系转换为联系实体,然后在联系实体上添加M 端N端P端的主键,然后加上联系实体自身的属性,就行了。

例子:说了这么多看个小例子。

这是一份关于商店商品仓库的ER图。

先看仓库和商品之间是M:N的关系,于是我们首先想到的应该是把联系库存转换为库存实体。

库存(仓库号,商品号,日期,库存量)然后是商品实体和仓库实体商品(商品号,商品名,单价)仓库(仓库号,仓库名,地址)除此之外仓库和商品还有一个供应关系,同样是M:N关系:供应(仓库号,商品号,月份,月供应量)在上图的商店和仓库之间的关系可能写漏了,但是它们应该也是M:N的关系,一个商店可以被多个仓库供应,一个仓库也可以供应多个商店。

将ER模型转换为关系模型的规则

将ER模型转换为关系模型的规则

将ER模型转换为关系模型的规则如下:(1)一个实体型转换为一个关系模式,实体的属性就是关系的属性,实体的码就是关系的码.(2)一个1:1的联系可以转换为一个独立的关系模式,也可以与任意一端对应的关系模式合并.如果转换为一个独立的关系模式,则与该联系相连的各实体的码及联系本身的属性均转换为关系的属性,每个实体的码均是该关系的候选键.(3)一个1:n联系可以转换为一个独立的关系模式,也可以与任意n端对应的关系模式合并。

如果转换为一个独立模式,则与该联系相连的各实体的码及联系本身的属性均转换为关系的属性,而关系的码为n端的实体的码。

如果与n 端实体对应的关系模式合并,则需要在该关系模式的属性中加入1端关系模式的码和联系本身的属性。

(4)一个m:n的联系可以转换为一个独立的关系模式,与该联系相连的各实体的码及联系本身的属性均转换为关系的属性,而关系的码为各实体码的组合。

(5)三个以上实体间的一个多元联系可以转换为一个独立的关系模式,与该联系相连的各实体的码及联系本身的属性均转换为关系的属性,而关系的码为各实体码的组合。

S1: 处理强实体建立一个新表T,将所有简单属性(复合属性拆解为简单属性)添加进表,确定主码;S2: 处理1:1的弱实体W找到其依附的强实体所映射的表T,将弱实体所有简单属性(复合属性拆解为简单属性)添加进该表;S3: 处理1:N或M:N的弱实体W建立一个新表T,将W所有简单属性(复合属性拆解为简单属性)添加进T表;如果是1:N的弱实体,添加W依附的强实体的主码为外码到T表,T表的主码由该外码和W的鉴别器组成;如果是N:M的弱实体,建立新的具有唯一值的一列为主码;S4: 处理1:1的联系R确定参与该联系的表S和T,选定全参与的一方S,将另一方T的主码作为外码加入S,将联系R的所有属性(复合属性拆解为简单属性)添加入S;S5: 处理1:N的联系R确定处于N端的实体S和处于1端的实体T,将T的主码作为外码加入S,将联系R的所有属性(复合属性拆解为简单属性)添加入S;S6: 处理N:M的联系R建立新表T,将参与该关系的实体的主码作为外码加入T,将联系R的所有属性(复合属性拆解为简单属性)添加入T;S7: 处理多值属性A建立新表T,将A的所有属性(复合属性拆解为简单属性)添加入T,将A所属的实体或联系的主码作为外码加入T,将该外码和A对应的属性作为T的主码。

e-r模型和关系模型的转化过程

e-r模型和关系模型的转化过程

e-r模型和关系模型的转化过程
ER模型和关系模型的转化过程,通常包括以下步骤:1. 实体转化为关系表:根据ER模型中的实体,将每个实体转化为一个关系表。

实体的属性将成为关系表的字段,实体的键(或者选择性标识符)将成为关系表的主键。

2. 关系转化为关系表:根据ER模型中的关系,将每个关系转化为一个关系表。

关系的属性将成为关系表的字段,关系的键将成为关系表的外键。

3. 引入关系表之间的引用关系:根据ER模型中的联系,将关系表之间的引用关系进行转化。

这可以通过将一个关系表的外键引用另一个关系表的主键来实现。

4. 引入主键和外键约束:根据ER模型中的主键和外键约束,将这些约束加入到关系模型中,以保证数据的完整性和一致性。

5. 校验模型的完整性:在转化过程中,需要确保模型的完整性,即关系模型中的所有实体、属性、关系和约束都得到了正确的转化和校验。

6. 优化模型的性能:根据具体的应用需求和性能要求,可以对关系模型进行优化,包括设定索引、拆分关系表、优化查询等等。

ER模型转换为关系模型规则

ER模型转换为关系模型规则

ER模型转换为关系模型规则ER模型是一种用于描述实体之间关系的图形化工具,在数据库设计中起着非常重要的作用。

ER模型可以被转换为关系模型,以便实现数据库的设计和实现。

关系模型是数据库中数据的逻辑结构表示,它由表格(称为关系)组成,每个表格存储了相关数据的行。

在关系模型中,实体将被表示为表,而关系将被表示为表之间的关系。

在将ER模型转换为关系模型时,需要遵循一些规则和步骤。

首先,将ER模型中的实体转换为关系模型中的表。

每个实体将对应一个表,表的名称应该与实体名称相同。

每个表中将包含与实体属性对应的列。

例如,在一个学生信息系统的ER模型中,可以有一个名为"学生"的实体,其中包含姓名、学号、性别等属性。

将这些属性转换为该实体对应的表中的列。

其次,将ER模型中的关系转换为关系模型中的表之间的关系。

关系可以是一对一、一对多或多对多的关系。

对于一对一关系,可以将关系的主键作为一个表的外键,以便建立关系。

对于一对多或多对多的关系,通常需要建立一个中间表来表示这种关系。

例如,在一个学生和课程之间存在多对多的关系,可以创建一个名为"选课"的中间表,其中包含学生ID 和课程ID的列,用于表示学生和课程之间的关系。

在将ER模型转换为关系模型时,还需要遵循以下规则:1.每个表应该有一个主键,用来唯一标识表中的每一行数据。

主键可以是一个属性,也可以是多个属性的组合。

主键的值不能为NULL,且必须是唯一的。

2.如果一个属性可以有多个取值,应将其拆分为一个独立的表,以消除重复数据。

例如,如果一个学生可以选择多个课程,在学生表中不应该保存课程信息,而应该创建一个独立的表来保存学生选课信息。

3.外键是用来建立表之间关系的关键。

外键是一个指向另一张表的列,用于建立表之间的关系。

通常情况下,外键应该与另一张表的主键对应。

在创建外键时,需要确保外键的值在被关联表的主键中存在。

4.每个表应该符合数据规范化的要求,以避免数据冗余和插入、更新、删除异常。

建立ER图根据具体语义把ER图转换为关系模式

建立ER图根据具体语义把ER图转换为关系模式

color
pname
jname
根据规则可以转换成如下的四个关系模式:
供应商(供应商号,姓名,城市) 项目(项目号,项目名称,城市) 零件(零件号,零件名称,零件颜色,零件数目) 供应(供应商,号项目,号零件号,日期)
四、数据模型的优化
数据库设计的结果不是惟一确定的。为了进一步提高数据库 应用系统的性能,还应该适当地修改、调整数据模型的结构, 这就是数据模型的优化。具体的优化步骤如下: ► 确定数据依赖。 ► 对各个关系模式之间的数据依赖进行极小化处理,消除冗 余联系。 ► 确定关系模式分别属于第几范式。 ► 分析模式是否适用于应用环境,从而确定是否要对某些模 式进行分解和合并。必须注意的是,并不是规范化程度越高 的关系就越好。就一般而言,规范达到第三范式就足够了。 ► 对关系模式进行必要的分解,提高数据操作效率和存储空 间的利用率。
方法:分析和表达用户需求常采用的方法自顶向下和自 底向上两类方法,其中最为实用的是自顶向下的结构化分 析(Structured Analysis,简称SA)方法。 结果:形成系统需求说明书,包括数据字典框架、数据 流图、系统功能框图及其说明,它将作为数据库设计全过 程的重要依据。数据字典包括数据项、数据结构、数据流、 数据存储和处理过程。
三、概念结构设计
任务:产生反映组织需求的数据库概念模型,它独立 于数据库逻辑结构,独立于具体的DBMS。 方法:自顶向下、自底向上、逐步扩张和混合策略。 工具:E-R图。 步骤:数据抽象→局部概念模式→全局概念模式→概 念模式评价和改进。 结果:完成局部概念模式描述(局部E-R图)和全局概 念模式描述(全局E-R图),提交修改后的数据清单和业 务活动清单。
结果:形成物理设计说明书,说明书中包括存储格 式、存储位置、访问方法、交互界面和输入/输出格式 说明。
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

3.2.3 Mapping from ER Models to RelationalModels∙Mapping Algorithm∙ExampleThere is almost a one-to-one correspondence between the ER constructs and the relational ones. The two major distinctions are:1.In a relational schema, relationships are represented implicitly through primary andforeign keys of participating entities.2.In a relational schema, columns of relations cannot be multi-valued or composite.Composite attributes are replaced with their simple component ones, andmulti-valued attributes are stored in a separate relation.一.Mapping AlgorithmWe can translate an ER schema to a relational schema by following a nine-step algorithm based on the one given in Elmasri and Navathe 1994. The algorithm attempts to minimize the need for joins and NULL values when defining relations (Steps 2, 4, and 5).1.For each strong entity E:o Create a new table.o Include as its columns, all the simple attributes and simple components of the composite attributes of E.o Identify the primary key and the alternate keys. Do not include anymulti-valued attribute as a key. If the only unique field of an entity is amulti-valued attribute, introduce an artificial primary key field.2.For each weak entity W that is associated with only one 1:1 identifying ownerrelationship:o Identify the table T of the owner entity type.o Include as columns of T, all the simple attributes and simple components of the composite attributes of W.3.For each weak entity W that is associated with a 1:N or M:N identifying relationship,or participates in more than one relationship:o Create a new table T.o Include as its columns, all the simple attributes and simple components of the composite attributes of W.o Form the primary key of T as follows:▪In the case of a 1:N owner relationship, by including as a foreign key in T, the primary key of the owner entity. The primary key of T isthe combination of W's partial key and the foreign key.▪In the case of an M:N owner relationship, create a new column that will hold unique values. (In this case, the association between theweak entity and its owner entity will be specified in Step 6.)4.For each binary 1:1 relationship R:o Identify the tables S and T of the participating entity types.o Choose S (preferably the one with total participation).o Include as a foreign key in S, the primary key of T.o Include as Columns of S, all the simple attributes and simple components of the composite attributes of R.5.For each binary 1:N relationship R:o Identify the table S (at the N-side) and T of the participating entities.o Include as a foreign key in S, the primary key of T.o Include as columns of S, all the simple attributes and simple components of composite attributes of R.6.For each N-ary relationship (including binary N:M relationship) R:o Create a new table T.o Include as columns of T, all the simple attributes and simple components of composite attributes of R.o Include as a foreign keys, the primary keys of the participating (strong or weak) entity types.o Specify as the primary key of T, the list of foreign keys.7.For each multi-valued attribute A:o Create a new table T.o Include as columns of T, the simple attribute or simple components of the attribute A.o In table T, include as a foreign key, the primary key of the entity or relationship type that has A.o Specify as the primary key of T, the foreign key and the columnscorresponding to A.8.For each specialization with disjoint subclasses:o Create a new table T i for each subclass S i.o Include as columns of T i, the simple attributes and simple component attributes of the superclass.o Include as columns of T i, the simple attributes and simple component attributes specific to S i.o Identify the primary key.9.For each specialization with overlapping subclasses:o Create a new table O for the superclass.o Include as columns of O, the simple attributes and the simple component attributes of the superclass.o Identify its primary key and alternate keys.o Create a new table T i for each subclass S i.o Include as columns of T i, the simple attributes and simple component attributes specific to S i.o Include as a foreign key in T i(to be part of the primary key of T i), the primary key of O.二.ExampleLet us convert our library ER schema into a relational one using the above mapping algorithm. We tag each definition with the step Si (i = 1..9) in the algorithm that introduced it.∙In step1, we map all the entities types into tables and define their primary keys PKs and alternate keys AKs. Note that Author in TITLE is a multi-valued attribute andas such will be handled in Step 7. All the composite attributes, e.g., DriverLic inMEMBER, are broken down to their components that are included as separatecolumns.∙S1 TITLE(Name, ISBN, CallNumber, Year, Publisher);∙S1 PK(CallNumber)∙S1 AK(ISBN)∙∙S1 MEMBER(MemNo, DriverLicState, DriverLicNo, Fname, MI, Lname, Address, PhoneNumber);∙S1 PK(MemNo)∙S1 AK(DriverLicState,DriverLicNo)∙∙S1 BOOK(Book_Id, Edition);∙S1 PK(Book_Id)∙∙S1 LIBRARIAN(SSN, Name, Address, Salary, Gender, Birthday);∙S1 PK(SSN)∙∙S1 SECTION(SectNo, Name);∙S1 PK(SectNo)∙In step 2, we do not take any action, since there are no weak entities satisfying the 1:1 relationship constraint. DEPENDENT is a weak entity with 1:N relationship constraint, namely, DEPENDS, and will be handled in the next step. If we had to take any action, this would have been along the lines of step 4.∙In step 3, we create a table for each remaining weak entity that was not handled in step2. In our example, we create only one, namely DEPENDENT.∙S3 DEPENDENT(LIBSSN, Name, Birthday, Kinship);∙S3 PK(LIBSSN, Name)∙S3 FK(LIBSSN) --> LIBRARIAN(SSN)The primary key is formed by LIBSSN, the primary key of the owner entity LIBRARIAN, and Name, the partial key of DEPENDENT. LIBSSN is a foreign key (FK) in the DEPENDENT table.∙In Step 4, we consider the binary 1:1 relationships. In our example, MANAGES is such a relationship. Since all sections have a head librarian, we choose the SECTION table into which to capture (collapse) the relationship. By choosing SECTION, we avoid storing any NULL values, which would have been the case, had we decided to choose librarians. This is because not all librarians head a section and for any librarian who is not a head librarian, the corresponding column would be NULL.We collapse the MANAGES relationship by including the primary key of LIBRARIAN, i.e., the SSN of the head librarian, as a foreign key in SECTION, i.e., HeadSSN.S1 SECTION(SectNo, Name, HeadSSN);S1 PK(SectNo)S4 FK(HeadSSN) --> LIBRARIAN(SSN)∙In step 5, we consider 1:N relationships. Here we have five such relationships in our example, namely, BORROW, CHECKS, COPY, WORKS and SUPERVISES. In each case, we choose the table that corresponds to the N-side of the relationship and collapse the relationship in the selected table including all the attributes of the relationship as columns in the table.The reason for selecting the N-side table is as follows. Given that each row in the N-side table can be related to only one row of the 1-side table, we need to introduce only one column in the N-side table to capture the relationship. This will bea foreign key in the N-side table corresponding to the primarykey of the 1-side table. If we had selected the 1-side table, then we would have to specify as many foreign keys as the numberof related entities. In general, N is not bounded and hence we cannot predict how many foreign key columns to introduce. If we attempt to make a prediction we run the risk of either overestimating or underestimating. If we overestimeate, our table will contain a great number of NULL values which is a waste of space. If we underestimate, our table will not be able to store a relationship and hence our database will fail to meet fully its intended usage.In our example, we choose BOOK for BORROW, BOOK for CHECKS, and BOOK for COPY. Hence we introduce three foreign keys in BOOK, namely, BorrowerMemNo, LibCheck and CallNumber, respectively.S1 BOOK(Book_Id, Edition, BorrowerMemNo, BorrowDueDate, CallNumber,LibCheck);S1 PK(Book_Id)S5 FK(BorrowerMemNo) --> MEMBER(MemNo)S5 FK(CallNumber) --> TITLE(CallNumber)S5 FK(LibCheck) --> LIBRARIAN(SSN)For the WORKS and SUPERVISES relationships we choose LIBRARIAN and introduce the foreign keys Section and SuperSSN.S1 LIBRARIAN(SSN, Name, Address, Salary, Gender, Birthday, SuperSSN, Section);S1 PK(SSN)S5 FK(SUPERSSN) --> LIBRARIAN(SSN)S5 FK(Section) --> SECTION(SectNo)∙In step 6, we consider the M:N relationships. In our example, HOLD is such a relationship. We create a new table to store this relationship and its attribute, namely Date. As above, the relationship is expressed using foreign keys. For each participating table, in our example, MEMBER and TITLE, we include a foreign key referring to their primary keys, namely MemNo and CallNumber, respectively.∙S6 HOLD(MemNo, CallNumber, Date);∙S6 PK(MemNo, CallNumber)∙S6 FK(MemNo) --> MEMBER(MemNo)∙S6 FK(CallNumber) --> TITLE(CallNumber)The reason for creating a new table is that we cannot collapse an N:M relationship in any of the participating tables without guessing the required number of foreign keys as we discussed in step 5, above.∙In the last step for ER schemas, step 7, we consider all multi-value attributes. In our example, we have one multi-valued attribute, namely, Authors in TITLE. We storesuch an attribute as a separate table, e.g., AUTHOR, whose rows correspond to each of the values of the multi-valued attribute. In order to relate these values to the originating table, we include the primary key of the originating table, in our case, TITLE, as a foreign key in AUTHOR.∙S7 AUTHOR(CallNumber, Fname, MI, Lname);∙s7 PK(CallNumber, Fname, MI, Lname)∙s7 FK(CallNumber) --> TITLE(CallNumber)Let us conclude by listing the entire relational schema produced above. It is worth recalling here that PK, AK, and FK correspond to PRIMARY KEY, UNIQUE and FOREIGN KEY REFERENCES statements, respectively, in SQL.S1 TITLE(Name, ISBN, CallNumber, Year, Publisher);S1 PK(CallNumber)S1 AK(ISBN)S1 MEMBER(MemNo, DriverLicState, DriverLicNo, Fname, MI, Lname, Address, PhoneNumber);S1 PK(MemNo)S1 AK(DriverLicState, DriverLicNo)S1 BOOK(Book_Id, Edition, BorrowerMemNo, BorrowDueDate, CallNumber, LibCheck); S1 PK(Book_Id)S5 FK(BorrowerMemNo) --> MEMBER(MemNo)S5 FK(CallNumber) --> TITLE(CallNumber)S5 FK(LibCheck) --> LIBRARIAN(SSN)S1 LIBRARIAN(SSN, Name, Address, Salary, Gender, Birthday, SuperSSN, Section); S1 PK(SSN)S5 FK(SuperSSN) --> LIBRARIAN(SSN)S5 FK(Section) --> SECTION(SectNo)S1 SECTION(SectNo, Name, HeadSSN);S1 PK(SectNo)S4 FK(HeadSSN) --> LIBRARIAN(SSN)S3 DEPENDENT(LIBSSN, Name, Birthday, Kinship);S3 PK(LIBSSN, Name)S3 FK(LIBSSN) --> LIBRARIAN(SSN)S6 HOLD(MemNo, CallNumber, Date);S6 PK(MemNo, CallNumber)S6 FK(MemNo) --> MEMBER(MemNo)S6 FK(CallNumber) --> TITLE(CallNumber)S7 AUTHOR(CallNumber, Fname, MI, Lname);S7 PK(CallNumber, Fname, MI, Lname)S7 FK(CallNumber) --> TITLE(CallNumber)© Copyright 1999-2004, iCarnegie, Inc. All rights reserved.。

相关文档
最新文档