页数:22页文件大小:139.4 KB来源: 计算机专业英语ppt课件
本课件对应4.3 Structure of the Relational Database II(关系数据库结构(二))一节,介绍实体联系建模方法与数据建模过程,说明关联表、交集表及实体属性到表字段的映射。课文配中英文对照译文、生词短语表与课后练习,可用于课堂讲授与课前预习。
| 单词 | 词性 | 中文释义 |
|---|---|---|
| attribute | n. | 属性 |
| bonus | n. | 奖金 |
| conceptualize | v. | 使有概念,构思 |
| derive | v. | 得自,起源 |
| enrollment | n. | 登记,注册,入伍,入会,入学 |
| iterate | v. | 反复说,重申,重述 |
| restrict | v. | 约束,限制Phrases |
数据建模
斯科特在创建数据库的真实表之前,要经过一个称作数据建模的过程。在这个过程中,数据库创建者定义和填写数据库中的所有表。一种为数据库建模的常用方式叫作ERA,ERA可以表示出实体、实体间的关联和实体的属性。
Data Modeling
Before Scottcreated the actual tables in the database, he went through a design process known as data modeling. In this process, the developer conceptualizes and documents all the tables for the database. One of the common methods for modeling a database is called ERA, which stands for entities, relationships, and attributes. 4.3 Structure of the Relational Database II
数据库设计者使用一个能够支持实体、实体属性和实体间关联的应用程序。通常,一个实体对应数据库中的一个表,而实体的属性对应于表中的列。
The database designer uses an application that can maintain entities, their attributes, and their relationships. In general, an entity corresponds to a table in the database, and the attributes of the entity correspond to columns of the table.
数据建模:定义实体、实体属性和实体间关联的过程,为建立物理数据库做准备。
Data Modeling:A process of defining the entities, attributes, and relationships between the entities in preparation for creating the physical database.
数据建模过程包括定义实体、定义实体间关联以及定义每个实体的属性。一个周期完成后需要不断重复,直到设计者抓住了足以建立数据库的重点。让我们进一步了解数据建模过程的各个步骤。
The data-modeling process involves defining the entities, defining the relationships between those entities, and then defining the attributes for each of the entities. Onceacycleis complete, it is repeated as many times as necessary to ensure that the designer is capturing what is important enough to go into the database. Let'stakea closer look at each step in the data-modeling process.
定义实体
首先,设计者确定数据库应用程序范围内的所有实体。实体是机构中重要的且需要记录在数据库中的人、地方或事物。实体将巧妙地转化为数据表。
Defining the Entities
First, the designer identifies all of the entities within the scope of the database application. The entities are the persons, places, or things that are important to the organization and need to be tracked in the database. Entities will most likely translate neatly to database tables.
例如,在斯科特饰品公司数据库第一版中,斯科特定义了四个实体:员工、部门、工资水平和奖金。这些实体将成为EMP(员工)表,DEPT(部门)表,SALGRADE(工资水平)表和BONUS(奖金)表。
Forexample, for the first version of Scott'swid get company database, he identifies four entities: employees, departments, salary grades, and bonuses. These will become the EMP, DEPT, SALGRADE, and BONUStables.
定义实体间的关联
一旦定义了实体,设计者就能够继续定义每个实体间是如何关联的。通常,设计者将每个实体同其他实体配对,并且考虑:“两者之间是否存在关联呢?”实体间的某些关联是显而易见的,某些不是。
Defining the Relationships between Entities
Once the entities are defined, the designer can proceed with defining how each of the entities is related. Often, the designer will pair each entity with every other entity and ask,"Is there a relationship between these two entities?"Some relationships are obvious; some are not.
[1]Inthewidget company database, there is most likely a relationship between EMPand DEPT, but depending on the business rules, it is unlikely that the DEPTand SALGRADE entities are related. If the business rules were to restrict certain salary grades to certain departments, there would most likely be a new entity that defines the relationship between salary grades and departments. This entity would be known as an associative or intersection table and would contain the valid combinations of salary grades and departments.
语言点分析:并列句。在后一个分句中it is unlikely that…意思是“……是不太可能的”,it是形式主语,后面的that从句是真正主语。
在饰品公司的数据库中,EMP与DEPT之间很可能有关联,但根据业务规则,DEPT和SALGRADE实体之间不太可能有关联。如果业务规则是用来约束某个部门的工资水平的,就可能需要一个新的实体来说明工资水平和部门之间的关联。这个实体被称作关联表或相交表,其中包含工资水平和部门之间的有效联合。
关联表:是一个数据库表,其中保存着另外两个表的行(记录)间的有效结合,通常强制执行业务规则。关联表处理多对多关联。
通常,关系数据库中有三种关联方式:
Associative Table:A database table that stores the valid combinations of rows from two other tables and usually enforces a business rule. An associative table resolves a many-to-many relationship.
In general, there are three types of relationships in a relational database
一对多关联:最常见的关联是一对多关联。一对多关联意思是:对于每个给出的现有实体(即父实体)都有一个或多个现有的另一个实体(即子实体)与之相关联。
One-to-many The most common type of relationship is one-to-many. This means that for each occurrence in a given entity, the parent entity, there maybe one or more occurrences in a second entity, the child entity, to which it is related.
例如,在饰品公司数据库中,部门实体(DEPT)是一个父实体;而对于每个部门,都有一个或多个员工与该部门有关系。部门实体(DEPT)和员工实体(EMP)间的关联就是一对多关联。
Forexample, in the widget company database, the DEPTentityis a parent entity, and for each department, there could be one or more employees associated with that department. The relationship between DEPTand EMPisone-to-many.
一对一关联:在一个一对一关联中,表中的一行只关联另一个表中的一行或者0行。这种关联类型通常用于子类型。例如,一个员工表可能保存了所有员工的信息,而全职表、兼职表和承包人表则分别只保存全职员工、兼职员工和承包人的信息。
One-to-one Inaone-to-one relationship, arowina table is related to only one or none of the rowsina second table. This relationship type is often used for subtyping. Forexample, an EMPLOYEE table may hold the information common to all employees, while the FULLTIME, PARTTIME, and CONTRACT ORtableshold information unique to full-time employees, part-time employees, and contractors, respectively.
这些实体被认为是员工表的子表,并且同员工表维持一对一关联。这种关联不像一对多关联那么常见,因为如果一个实体与另一个实体总有对应行,在大多数情况下,两个实体中的属性只在一个实体内出现就可以了。
These entities would be considered subtypes of an EMPLOYEE and maintain a one-to-one relationship with the EMPLOYEE table. These relationships are not as common as one-to-many relationships, because if one entity has an occurrence for a corresponding row in another entity, in most cases, the attributes from both entities should be in a single entity.
Many-to-many[2]Inamany-to-many relationship, one rowofa table maybe related to many rows of another table, and viceversa. Usually, when this relationship is implemented in the database, a third entity is defined as an intersection table to contain the associations between the two entities in the relationship.
语言点分析:并列句,后一个分句中的viceversa意思是“反过来也是一样,反之亦然”。
多对多关联:在多对多关联中,一个表的一行可能对应另一个表的许多行,反之亦然。通常,在数据库中执行这些关联时,往往再定义第三个实体作为关联表用来保存前两个实体间的所有关联。
Forexample, in a database used for school class enrollment, the STUDENT table has a many-to-many relationship with the CLASStable—one student may take one or more classes, and a given class may have one or more students. The intersection table STUDENT_CLASS would contain the combinations of STUDENT and CLASStotrack which students are in which classes.
例如,在一个学籍注册数据库中,学生表与班级表之间有一个多对多关联——一个学生可能听一门或多门课程,并且一个班级也可能有一个或多个学生。而学生_班级关系表中就包含了学生和班级之间的关系,以表明哪个学生在哪个班。
指定实体属性
一旦设计者定义了实体间关联,下一步就是去指定每个实体的属性。这使用列来实现,如图所示为根据工资水平实体所建立的工资水平表。
Assigning Attributes to Entities
Once the designer has defined the entity relationships, the next step is to assign the attributes to each entity. This is physically implemented using columns, as shown here for the SALGRAD Etableas derived from the salary grade entity.
重复步骤:我们达到目标了么?
在定义了实体、关联以及属性之后,设计者往往要多次重复数据建模过程。回顾关联时,可能会发现新的实体。比如,当讨论饰品库存表以及它与客户订单的关联时,就会发现需要制定一个送货约束表。
Iteratethe Process: Are We There Yet?
After the entities, relationships, and attributes have been defined, the designer may iterate the data modeling many more times. When reviewing relationships, new entities maybe discovered. Forexample, when discussing the widget inventory table and its relationship to a customer order, the need for a shipping restrictions table may arise.
一旦设计过程完成,将要建立实际的数据库表。逻辑数据库的设计过程不会牵涉实际执行中的问题。但是当设计进入到实际的反复运作,数据库管理员就会让设计者从理想回到现实中来。结果,设计就可能需要再次构想以求得理想的数据库运行与现实的预算和进度之间的平衡。
Once the design process is complete, the physical database tables maybe created. Logical database design sessions should not involve physical implementation issues, but once the design has gone through an iteration or two, it's the DBA'sjob to bring the designers"down to earth". Asaresult, the design may need to be revisited to balance the ideal database implementation versus the realities of budgets and schedules.
习题4.3 一 判断正误:根据课文内容判断下列说法正误。
Put“true”or“false”in the brackets for the following statements according to the passage.
习题4.3 二 练习:根据课文内容完成下列练习。
Fillinthe blanks according to the passage.
习题4.3 三 翻译:将下列单词和短语译成中文。
Translate the following words and expressions into Chinese.
下载地址:{{downurl}}
{{{a}}}
{{#b}}{{{b}}}
{{/b}} {{/title}} {{#nolog}}登陆注册
{{/nolog}} {{#djsx}}点我刷新
{{/djsx}} {{#gocz}} {{/gocz}} {{#ffqr}} {{/ffqr}}