数据库系统概念第六章
The participation of an entity set E in a relationship set R is said to be total(全部的) if every entity in E participates in at least one relationship in R.
SSDUT-Software School of DUT
12
Attributes
For each attribute, there is a set of permitted values, called the domain(域), or value set(值集), of that attribute. An attribute of an entity set is a function that maps from the entity set into a domain. each entity can be described by a set of (attribute, data value) pairs
Mapping cardinalities(映射基数), or cardinality ratios(基数比率), express the number of entities to which another entity can be associated via a relationship set.
SSDUT-Software School of DUT
15
Attributes
Derived attribute(派生属性)
– The value can be derived from the values of
other related attributes or entities. instructor ’s attribute: students_advised students’s attribute: age – The value of a derived attribute is not stored but is computed when required.
SSDUT-Software School of DUT
4
Design Alternatives
must avoid two major pitfalls:
– Redundancy(冗余)
A bad design may repeat information. – Incompleteness(不完整) A bad design may make certain aspects of the enterprise difficult or impossible to model.
11
Relationship Sets
Most of the relationship sets in a database system are binary(二元的). Occasionally, however, relationship sets involve more than two entity sets.
into subparts – composite attributes(复合属性): can be divided into subparts a composite attribute may appear as a hierarchy
SSDUT-Software School of DUT
7
SSDUT-Software School of DUT
Entity Sets
SSDUT-Software School of DUT
8
Relationship Sets
Relationship(联系) :an association among several entities. relationship set(联系集) : a set of relationships of the same type.
SSDUT-Software School of DUT
9
Relationship Sets
The association between entity sets is referred to as participation; that is, the entity sets E1, E2, . . . , En participate(参与) in relationship set R. A relationship instance(联系实例) in an E-R schema represents an association between the named entities in the real-world enterprise that is being modeled. The function that an entity plays in a relationship is called that entity’s role(角色).
An attribute takes a null value when an entity does not have a value for it.
SSDUT-Software School of DUT
16
Constraints
SSDUT-Software School of DUT
17
Mapping Cardinalities
SSDUT-Software School of DUT
2
Overview of the Design Process
SSDUT-Software School of DUT
3
Design Phases
characterize the data needs conceptual-design
– One-to-one – One-to-many
SSDUT-Software School of DUT
18
Mapping Cardinalities
– Many-to-one
– Many-to-many
SSDUT-Software School of DUT
19
Participation Constraints
SSDUT-Software School of DUT
10
Relationship Sets
A relationship may also have attributes called descriptive attributes(描述性属性).
SSDUT-Software School of DUT
– {(ID, 76766), (name, Crick), (dept name, Biology),
(salary, 72000)}
SSDUT-Softwarees
Simple and composite attributes
– Simple attributes(简单属性): have not been divided
SSDUT-Software School of DUT
20
Keys
A key for an entity is a set of attributes that suffice to distinguish entities from each other. Keys also help to identify relationships uniquely, and thus distinguish relationships from each other.
SSDUT-Software School of DUT
5
The Entity-Relationship Model
SSDUT-Software School of DUT
6
Entity Sets
Entity(实体) : a “thing” or “object” in the real world that is distinguishable from all other objects. entity set(实体集) : a set of entities of the same type that share the same properties, or attributes. An entity is represented by a set of attributes (属性). Attributes are descriptive properties possessed by each member of an entity set. Each entity has a value(值) for each of its attributes.
14
Attributes
Single-valued and multivalued attributes
– Single-valued attributes(单值属性): have a single
value for a particular entity – multivalued attributes(多值属性): have a set of values for a specific entity An instructor may have zero, one, or several phone numbers any particular instructor may have zero, one, or more dependents {phone_number} or {dependent_name}. upper and lower bounds may be placed on the number of values