Академический Документы
Профессиональный Документы
Культура Документы
Diagrams
Chapter Objectives: In this chapter you should learn
1. What entity-relationship data modeling is
2. How to read and draw entity-relationship (E-R) diagrams
3. How to represent entity classes, attributes, and relationship
types in E-R diagrams
4. How to add cardinality and other constraints to E-R diagrams
5. How to model video rentals
information using E-R diagrams
and
other
BigHit
Video
Entity-Relationship Modeling
E-R data model is a high level conceptual model that describes data as entities,
attributes, and relationships.
The data modeling process is iterative: You start putting some ideas together, then
the process reveals some problems in your thinking. So, you go back and rework
your ideas.
Entity-Relationship Diagrams
E-R diagrams enable designers and users to express their understanding of what the
planned database is intended to do and how it might work, and to communicate
about the database through a common language.
Examples of E-R Diagram Symbols
Figure 4.4 E-R Diagram for the Owns Relationship Type Showing Cardinality and
Participation Constraints
Figure 4.7 E-R Diagram of a Combined Current and Previous Rental Relationship
Type
Figure 4.8 An E-R Diagram Showing Entity Class Rental and Its Relationship
Types
We have an entity with no distinguishing attributes that is partly identified by its
relationship to other entities. We call this a weak entity and class Rental a weak
entity class.
One difficulty with understanding the meaning of Rental entities is the problem of
distinguishing between one rental and another solely bases on attributes values.
Figure 4.10 Relationship Types IsMarriedTo and IsChildOf, with Role Names
The names of the roles wife, husband, child, and parent are shown in the diagram
next to the relationship-type lines.
Additional information from the figure is expressed by the following sentences:
A person may be the child of one or two parents
A person may be the parent of zero or more children
A person may be the wife of a husband
A person may be the husband of a wife
Figure 4.14 E-R Diagram for Entity Class PreviousRental with Optional Customer
Participation
The precise specification of the cardinalities exposes the kinds of issues that can
arise from real business practices. It is users' responsibility to determine whether
the E-R model adequately represents their enterprise and meets its needs.
Figure 4.15 E-R Diagram for WorksIn and Manages with Modified Cardinality and
Participation Constraints
Figure 4.18 E-R Diagram for Suppliers, Purchases, Movies, and Videos
Employees, Time Cards, and Pay Statements
These weak entity classes record when employees work and what they are paid. In
both cases, the entities are not uniquely determined by their identifying
relationships.
For instance, a pay statement is identified by its related employee, but is not unique
for that employee.
It is the combination of the employee's ssn and datePaid that is unique.
Figure 4.19 TimeCard, PayStatement, and their Related Entity Classes from Figure
4.12
Figure 4.20 E-R Diagram with dvd and videotape Attributes of Entity Class Video
To clearly distinguish between videotapes and DVD's, we can create two new entity
classes, one for each media type. We add the appropriate attributes to each class.
Figure 4.21 E-R Diagram Showing Classes DVD and Videotape as Unrelated
Classes
The object-oriented approach to representing this information recognizes that there
is a commonality between videotape objects and DVD objects.
Figure 4.22 E-R Diagram with Relationship Types for Classes DVD and Videotape
The meaning of inheritance. Each entity of class Video may be a member of either
class DVD or class Videotape.
Figure
4.23
Object-Oriented
Classes Video, DVD, and Videotape
E-R
diagram
for
Entity
Figure 4.24 E-R Diagram Showing Optional and Overlapping Inheritance for
Class Employee
Disjoint Rule (d) - Specifies that if an entity instance (of the super type) is a
member of one subtype, it cannot simultaneously be a member of any other
subtype.
Attribute
Customer
accountId
Key
lastName
Not null
firstName
shippingAddresses
Multi-valued
composite
components name, street,city, state, zipcode
with
Multi-valued
composite
components type,accountNumber, expiration
with
emailAddress
creditCards
Movie
password
movieId
Key
title
genre
DVD
media
languages
Subclass of Movie
videoFormat
captioning
Videotape
format
Subclass of Movie
soundtrack
Sale
saleId
Key
totalCost
dateSold
ShoppingCart
creditCard
Composite
components type, accountNumber,andexpiration
cartId
Key
dateCreated
with
Entity Class
Entity Class
Cardinality
Ratio
Purchases
Customer
Sale
one-to-many
Includes
Sale
Movie
many-to-many
Selects
Customer
ShoppingCart
one-to-many
Includes
ShoppingCart
Movie
many-to-many
Attibutes
quantity
quantity
Key Terms
A table that contains the descriptions of classes and the types,
descriptions, and constraints on attributes of an information system
An attribute of a weak entity class that identifies an entity from among
Discriminator
or
all of those with the same identifying entities. A discriminator is part of
partial key
the key of the weak entity class
A high-capacity compact disk that is used for storing video as well as
DVD
audio and data
Entity-relationship
A graphical strategy for representing E-R models
(E-R) diagram
Entity-relationship A strategy for constructing conceptual data models using diagrams that
(E-R) model
focus on entity classes, relationship types, and attributes
Data dictionary
Identifying
relationship type
A to-one relationship type between a weak entity class and its owner
entity class that helps to uniquely identify an entity of the weak class
A relationship type in which the subclass (child) is related to a
Inheritance
(is-a)
superclass (parent). Each object of the subclass is also an object of the
relationship type
superclass and inherits all of the superclass attributes and relationships
A conceptual data model that divides objects into classes and supports
Object-oriented
the direct representation of inheritance relationship types. E-R
data model
diagramming supports the inclusion of object-oriented features
An entity class with no key of its own, whose objects cannot exist
without being related to other objects. A weak entity class must have at
Weak entity class
least one identifying relationship type and corresponding owner entity
class