Database Lecture4r
Database Lecture4r
Relationship (ER)
Modeling
1
Chapter Objectives
2
The Entity Relationship Model
• The entity relationship model (ERM) forms the basis of an ERD
− The ERD represents the conceptual database as viewed by the end user
3
Entities
• An entity is an object of interest to the end user
− An entity refers to the entity set and not to a single entity occurrence
• In Chen, Crow’s Foot, and UML notations, an entity is represented by a rectangle that
contains the entity’s name
− The entity name, a noun, is usually written in all capital letters
4
Attributes (1 of 4)
• Attributes are characteristics of entities
• A required attribute is an attribute that must have a value and cannot be left empty
• An optional attribute does not require a value and can be left empty
• Attributes must have a domain, which is the set of possible values for a given
attribute
• An identifier is one or more attributes that uniquely identify each entity instance
5
Attributes (2 of 4)
• A composite attribute is an attribute that can be subdivided to yield additional
attributes
6
Attributes (3 of 4)
7
Attributes (4 of 4)
8
Relationships
• The entities that participate in a relationship are also known as participants and each
relationship is identified by a name that describes the relationship
9
Connectivity and Cardinality (1 of 2)
10
Connectivity and Cardinality (2 of 2)
11
Existence Dependence
• If an entity can exist apart from all of its related entities, it is existence-independent
− It is referred to as a strong entity or regular entity
12
Relationship Strength (1 of 3)
13
Relationship Strength (2 of 3)
14
Relationship Strength (3 of 3)
15
Weak Entities (1 of 3)
16
Weak Entities (2 of 3)
17
Weak Entities (3 of 3)
18
Relationship Participation (1 of 3)
• Optional participation means that one entity occurrence does not require a
corresponding entity occurrence in a particular relationship
19
Relationship Participation (2 of 3)
20
Relationship Participation (3 of 3)
21
Relationship Degree (1 of 3)
22
Relationship Degree (2 of 3)
23
Relationship Degree (3 of 3)
24
Knowledge Check Activity 4-1
25
Recursive Relationships (1 of 2)
• A recursive relationship can exist between occurrences of the same entity set
− Naturally, such a condition is found within a unary relationship
• One common pitfall when working with unary relationships is to confuse participation
with referential integrity
− Similar because they are both implemented through constraints on the same set
of attributes
27
Recursive Relationships (2 of 2)
28
Associative (Composite) Entities (1 of 2)
• The ER model uses the associative entity to represent an M:N relationship between
two or more entities
• It is also called a composite or bridge entity and is a 1:M relationship with the parent
entities
− It is composed of the primary key attributes of each parent entity
• The composite entity may also contain additional attributes that play no role in
connective process
29
Associative (Composite) Entities (2 of 2)
30
Developing an ER Diagram (1 of 7)
31
Developing an ER Diagram (2 of 7)
32
Developing an ER Diagram (3 of 7)
33
Developing an ER Diagram (4 of 7)
34
Developing an ER Diagram (5 of 7)
35
Developing an ER Diagram (6 of 7)
36
Developing an ER Diagram (7 of 7)
Table 4.4 Components of the ERM
Entity Relationship Connectivity Entity
SCHOOL operates 1:M DEPARTMENT
DEPARTMENT has 1:M STUDENT
DEPARTMENT employs 1:M PROFESSOR
DEPARTMENT offers 1:M COURSE
COURSE generates 1:M CLASS
SEMESTER includes 1:M CLASS
PROFESSOR is dean of 1:1 SCHOOL
PROFESSOR chairs 1:1 DEPARTMENT
PROFESSOR teaches 1:M CLASS
PROFESSOR advises 1:M STUDENT
STUDENT enrolls in M:N CLASS
BUILDING contains 1:M ROOM
ROOM is used for 1:M CLASS
37
Database Design Challenges: Conflicting
Goals (1 of 2)
• Database designers must often make design compromises that are triggered by
conflicting goals
− Database design must conform to design standards
− High processing speed may limit the number and complexity of logically desirable
relationships
− Maximum information generation may lead to loss of clean design structures and
high transaction speed
• A design that meets all logical requirements and design conventions is an important
goal
38
Database Design Challenges: Conflicting
Goals (2 of 2)
39
Knowledge Check Activity 4-2
40
Summary
Now that the lesson has ended, you should be able to:
42
Solve this!
Given the following brief summary for the CM catering service, draw the fully labeled
ERD. Make sure to include all appropriate entities, attributes, relationships,
connectivities, and cardinalities.
− Each dinner is based on a single entrée, but each entrée can be served at many
dinners. A guest can attend many dinners, and each dinner can be attended by
many guests. Each dinner invitation can be mailed to many guests, and each
guest can receive many invitations.
43