Professional Documents
Culture Documents
Entity-Relationship Model: Database Management System
Entity-Relationship Model: Database Management System
Design Process
Modeling
Constraints
E-R Diagram
Design Issues
Weak Entity Sets
Extended E-R Features
Reduction to Relation Schemas
Database Design
ER Model
Modeling
3
ER Model
Relationship Sets
5
ER Model
Relationship Set advisor
6
ER Model
Relationship Sets (Cont.)
7
An attribute can also be property of a relationship set.
For instance, the advisor relationship set between entity sets
instructor and student may have the attribute date which tracks
when the student started being associated with the advisor
ER Model
Degree of a Relationship Set
8
binary relationship
involve two entity sets (or degree two).
most relationship sets in a database system are binary.
Relationships between more than two entity sets
are rare. Most relationships are binary. (More
on this later.)
Example: students work on research projects under the
guidance of an instructor.
relationship proj_guide is a ternary relationship between
instructor, student, and project
ER Model
Attributes
9
An entity is represented by a set of attributes, that is
descriptive properties possessed by all members of an entity
set.
Example:
instructor = (ID, name, street, city, salary )
course= (course_id, title, credits)
Domain – the set of permitted values for each attribute
Attribute types:
Simple and composite attributes.
Single-valued and multivalued attributes
Example: multivalued attribute: phone_numbers
Derived attributes
Can be computed from other attributes
Example: age, given date_of_birth
ER Model
Composite Attributes
10
ER Model
Mapping Cardinality Constraints
11
ER Model
Mapping Cardinalities
12
ER Model
Keys for Relationship Sets
14
ER Model
Redundant Attributes
15
ER Model
E-R Diagrams
16
ER Model
Entity With Composite, Multivalued, and Derived
Attributes
17
ER Model
Relationship Sets with Attributes
18
ER Model
Roles
19
ER Model
Cardinality Constraints
20
ER Model
One-to-One Relationship
21
ER Model
One-to-Many Relationship
22
ER Model
Many-to-One Relationships
23
ER Model
Many-to-Many Relationship
24
ER Model
Participation of an Entity Set in a Relationship Set
25
Total participation (indicated by double line): every entity in the entity
set participates in at least one relationship in the relationship set
E.g., participation of section in sec_course is total
every section must have an associated course
Partial participation: some entities may not participate in any
relationship in the relationship set
Example: participation of instructor in advisor is partial
ER Model
Alternative Notation for Cardinality Limits
26
Cardinality limits can also express participation constraints
ER Model
E-R Diagram with a Ternary Relationship
27
ER Model
Cardinality Constraints on Ternary
Relationship
28
We allow at most one arrow out of a ternary (or
greater degree) relationship to indicate a
cardinality constraint
E.g., an arrow from proj_guide to instructor
indicates each student has at most one guide for a
project
ER Model
Weak Entity Sets
29
ER Model
Weak Entity Sets (Cont.)
30
ER Model
Weak Entity Sets (Cont.)
31
ER Model
E-R Diagram for a University Enterprise
ER Model
Reduction to Relation Schemas
33
ER Model
Representing Entity Sets With Simple Attributes
34
ER Model
Representing Relationship Sets
35
ER Model
Redundancy of Schemas
36
Many-to-one and one-to-many relationship sets that are total on the many-
side can be represented by adding an extra attribute to the “many” side,
containing the primary key of the “one” side
Example: Instead of creating a schema for relationship set inst_dept, add an
attribute dept_name to the schema arising from entity set instructor
ER Model
Redundancy of Schemas (Cont.)
37
ER Model
Composite and Multivalued Attributes
38
ER Model
Design Issues
40
ER Model
Design Issues
41
ER Model
Design Issues
42
ER Model
Binary Vs. Non-Binary Relationships
43
ER Model
Converting Non-Binary Relationships to Binary Form
44
ER Model
Converting Non-Binary Relationships (Cont.)
45
ER Model
Extended ER Features
Extended E-R Features: Specialization
47
ER Model
Specialization Example
48
ER Model
Extended ER Features: Generalization
49
ER Model
Specialization and Generalization (Cont.)
50
ER Model
Design Constraints on a
Specialization/Generalization
51
ER Model
Design Constraints on a
Specialization/Generalization (Cont.)
52
ER Model
Aggregation
53
Consider the ternary relationship proj_guide, which we saw earlier
ER Model
Aggregation (Cont.)
54
ER Model
Aggregation (Cont.)
55
Without introducing
redundancy, the following
diagram represents:
A student is guided by a
particular instructor on a
particular project
A student, instructor, project
combination may have an
associated evaluation
ER Model
Representing Specialization via Schemas
56
Method 1:
Form a schema for the higher-level entity
Form a schema for each lower-level entity set, include
primary key of higher-level entity set and local attributes
schema attributes
person ID, name, street, city
student ID, tot_cred
employee ID, salary
Drawback: getting information about, an employee
requires accessing two relations, the one corresponding
to the low-level schema and the one corresponding to the
high-level schema
ER Model
Representing Specialization as Schemas
(Cont.)
57
Method 2:
Form a schema for each entity set with all local and inherited
attributes
schema attributes
person ID, name, street, city
student ID, name, street, city, tot_cred
employee ID, name, street, city, salary
If specialization is total, the schema for the generalized entity set
(person) not required to store information
Can be defined as a “view” relation containing union of
specialization relations
But explicit schema may still be needed for foreign key constraints
Drawback: name, street and city may be stored redundantly for
people who are both students and employees
ER Model
Schemas Corresponding to Aggregation
58
ER Model
Schemas Corresponding to Aggregation (Cont.)
59
For example, to represent
aggregation manages between
relationship works_on and entity set
manager, create a schema
eval_for (s_ID, project_id, i_ID,
evaluation_id)
Schema proj_guide is redundant
provided we are willing to store null
values for attribute manager_name in
relation on schema manages
ER Model
E-R Design Decisions
60
ER Model
Symbols Used in E-R Notation (Cont.)
62
ER Model
Alternative ER Notations
63
Chen, IDE1FX, …
ER Model
Alternative ER Notations
64
ER Model