E-R Modeling (7/09)

Download Report

Transcript E-R Modeling (7/09)

Guide to Modeling
Keys to E-R diagrams
Entities

Things about which you need to store
data. One entity for each different
thing.




At least two attributes
At least two occurrences
Not a property of some other entity
Not a derived quantity (like a report)
Finding Entities




List things described in a business
narrative
List things that are read from or written
to in the process analysis of the system
Describe a record (occurrence) by
listing the attributes it has
Be certain you need to store data
Relationships



Relationships connect a record in one
entity to one or more records in another
entity (A recursive relationship connects
a record to records in the same entity)
Relationships connect records
(occurrences) not entities
Relationships do not change anything
(they are not processes)
Determining Relationships

Describe connections:





has a, orders a, contains a, etc.
on a common report page, line, etc.
Connect records, not attributes
Can be described by a passive phrase
Do not describe a change in values
Cardinality


How many records could be connected
to this one?
Two sided test.
1:N and 1:1


1-1 relationships are special cases of
1:M
Foreign key in the many table
M:N



Associations
Associations with data
Associations that occur more than once
ATTRIBUTE:
A description or property of a given entity
type.
•
•
•
Must depend on the entity key alone
Must contain information that we
explicitly need
Must have the same data type for all
entity occurrences
TYPES OF ATTRIBUTES:
•
•
Composite or Simple (atomic)
Single valued or Multivalued (repeating
group)
Relational database models cannot represent
multivalued attributes but objects and
structured databases can. Repeating groups
(sets of related multivalued attributes) usually
represent entities or subclasses.
Optionality
(Referential Integrity)
Records in a table that have a relationship
with another table may be restricted by
optionality requirements.


Relationship Optional
Relationship Mandatory (referential
integrity enforced)
Optionality
A constraint should be mandatory only if
the relationship must be known
whenever a record is first entered.
Most relationships are optional.
Maintaining Integrity
If a parent record is deleted then an
optionality relationships can be
maintained in several ways



Cascade delete
Cascade update
Cascade null
Typical Patterns





Simple “Ownership”
Product Order
Appointment
Journal Entry
Component Parts