Data Modeling Using The Entity-Relationship (ER) Model
Data Modeling Using The Entity-Relationship (ER) Model
Objectives:
• To illustrate how relationships between entities are defined and refined.
• To know how relationships are incorporated into the database design
process.
• To describe how ERD components affect database design and
implementation.
What is Conceptual Database
Design?
Two perspectives
Top-down
Data model is derived from an intimate
understanding of the business.
Bottom-up
Data model is derived by reviewing specifications
and business documents.
Composite versus Simple (Atomic)
Attributes
Database Systems
Composite versus Simple (Atomic)
Attributes
Database Systems
Single-Valued versus Multivalued
Attributes
Single Value
attributes have a single value for a particular entity
Age is a single-valued attribute of a person
Multivalued Attributes
attribute can have a set of values for the same entity
a Colors attribute for a car, or a College_degrees
attribute for a person.
Cars with one color have a single value,
two-tone cars have two color values.
person may have two or more degrees;
Database Systems
Stored versus Derived Attributes
Database Systems
Entity and its keys
Regular entity
Weak entity
An entity type with no key
Database Systems
FIGURE 7.1
The ER conceptual schema diagram for the COMPANY database.
Slide 7- 10
Entity-Relationship (ER) Modeling.
Association
between the
instances of one or
more entity types
Represents a set or
collection of objects in
the real world that share
the same properties
Crow’s Foot Notation
EntityName
EntityName Verb phrase
List of
Attributes
Acceptable
Entities
Examples of entities:
Person: EMPLOYEE, STUDENT, PATIENT
Place: STORE, WAREHOUSE
Object: MACHINE, PRODUCT, CAR
Event: SALE,REGISTRATION, RENEWAL
Concept: ACCOUNT, COURSE
Guidelines for naming and defining entity types:
An entity type name is a singular noun
An entity type should be descriptive and specific
An entity name should be concise
Event entity types should be named for the result of the event, not
the activity or process of the event.
Attributes
Identifier
A candidate key that has been selected as the unique
identifying characteristic for an entity type
Referential Attributes
Name Gender
StaffID IC
Staff
Staff
PK StaffID
Name
Gender
IC
Relationships
Associations between instances of one or more entity
types that is of interest
Given a name that describes its function.
• relationship name is an active or a passive verb.
Relationship name:
writes
Author Book
teaches
Professor Class
How Many??
2.4 Cardinality and Connectivity
Connectivity
1 M
Professor teaches Class
(1,4) (1,1)
Cardinality
Connectivity
teaches
Professor Class
(1,1) (1,4)
Cardinality
Connectivity
Chen Model
1 to represent one. 1
M to represent many
M
Crow’s Foot
One or
many Optional? – we’ll see
after this
Binary Relationships
1:M relationship
Relational modeling ideal
Should be the norm in any relational database design
M:N relationships
Must be avoided because they lead to data redundancies.
Can be implemented by breaking it up to produce a set of 1:M
relationships
Can avoid problems inherent to M:N relationship by creating a
composite entity or bridge entity
This will be used to link the tables that were originally related
in a M:N relationship
The composite entity structure includes-as foreign keys-at
least the primary keys of the tables that are to be linked.
The M:N Relationship Between STUDENT and CLASS
Bowser Accounting 1 (ACCT-211)
Intro to Microcomputing
Smithson
(CIS-220)
Intro to Statistics (QM-
261)
This CANNOT be implemented as shown next…..
The tables have many redundancies!!
+ CLASS_CODE
CLASS_CODE
+ STU_NUM
Changing the M:N relationship to TWO 1:M relationships
The database designer has 2 main options to
define a composite table’s primary key:
either
use the combination of those foreign
keys or create a new primary key.
Optional
Mandatory
M
1
Lecturer handles Class
(0,N) (1,1)
M N
Member Searches Books