Sie sind auf Seite 1von 25

2008 MindTree Consulting 2008 MindTree Limited

E-R Modeling
May 2009
2008 MindTree Limited Slide 2
Agenda
Database Design Levels
Entity
Relationships
Refining Model Relationships
Additional Relationship Types
Logical Model to Physical Model
Exercise
2008 MindTree Limited Slide 3
Data Model
Data Model is a graphical language for expressing statements
about the business
3 Main Blocks of a Data Model
Entities - Nouns
Attributes Adjectives or Modifiers
Relationships Verbs
Data Model is simply a matter of finding the right collections of
nouns, verbs, and adjectives and putting them all together
2008 MindTree Limited Slide 4
Entity
Entity
Entity is any person, place, thing, event or concept about which
information is kept
Entity is also defined as a set or collection of like individual objects
called Instances
Entity names are always singular e.g. Customer not Customers, Item
not Items
To have a common naming standard
To facilitate reading the diagram as a set of declarative statements
2008 MindTree Limited Slide 5
Attributes
Attributes
Properties of an entity are called Attributes of an entity
Each attribute captures a single piece of information about the
entity
Customer-Name is an attribute of a customer
Inversion Entry Attributes Commonly used to access an entity
Foreign Key Attributes Set of attributes that define the
primary key in the parent entity

2008 MindTree Limited Slide 6
Relationships
Relationships
Represent Activity, connections, links or associations between
entities
They are the verbs of a diagram that show how entities relate to
each other
Finding the right verbs to name a relation is often the challenge
Relationship Types
Zero-to-One
Zero-to-Many
One-to-One
One-to-Many
Many-to-Many
2008 MindTree Limited Slide 7
One-To-Many Relation
Examples
A TEAM <has> many PLAYERS
A SALESPERSON <sells> many PRODUCTS
One instance of the first (Parent) Entity is connected/related to many
instances of the second (Child) entity


Above diagram shows the graphical representation of the business
statement
A PLANE-FLIGHT <transports> many PASSENGERS

Relationships
2008 MindTree Limited Slide 8
Many-to-Many Relation
Instance in the first entity relates to one or more instances in a second entity
and an instance in the second entity also relates to one or more instances in
the first entity






Above diagram shows the graphical representation of the business statement
A CUSTOMER <rents> many MOVIE COPYs and A MOVIE COPY <is rented by> many
CUSTOMERS
All many to many relationships need to be fully discussed at later modeling
stages to ensure that the relationship is correctly modeled
Relationships
2008 MindTree Limited Slide 9
Role Names
The same entity has multiple relationships with another entity
playing different roles
Relationships
Depot
Despatch Form
despatches many products
recorded in
receives many products
recorded in
2008 MindTree Limited Slide 10
Entity Types based on relationships
Dependent Entity A child entity that depends on the foreign key
attribute of another entity
Existence Dependent Dependent Entity cannot exist unless its parent
does
Identification Dependent Dependent entity cannot be identified without
using the key of the parent
Independent Entity Entities that do not depend on any other entity
for identification
PLAYER ENTITY is identification dependent as
team-id is required to uniquely identify a player
Relationships
2008 MindTree Limited Slide 11
Refining Model Relationships
Relationship Cardinality
A relational property that defines exactly how many instances
appear in a child entity for each instance in the parent entity
Referential Integrity
Rule that specifies the action taken when a parent key is deleted
Actions available Cascade, Restrict, Set Null, Set Default, None
Rules vary depending on whether the entity is a parent or child in
the relationship
2008 MindTree Limited Slide 12
Refining Model Relationships
First Letter in the referential integrity symbol refers to database action
I(Insert), U(Update), D(Delete)
Second Letter refers to referential integrity option C(Cascade),
R(Restrict), SN(Set Null), SD(Set Default)
2008 MindTree Limited Slide 13
Refining Model Relationships
Many-to-Many Relationships
Relationships must relate zero or one instance in a parent entity to a
specific set of instances in a child entity
As a result of the above rule, many-to-many relations (in an earlier
modeling phase) must be broken down into a pair of one-to-many
relationships

2008 MindTree Limited Slide 14
Refining Model Relationships
Many-to-many relations can be eliminated using Associative entities
If many-to-many are not resolved COURSE will be included in the key of
STUDENT and vice versa (Defeats the purpose of defining Entities)
Many-to-many often hide meaning
2008 MindTree Limited Slide 15
Additional Relationship Types
N-ary Relationships
2008 MindTree Limited Slide 16
Additional Relationship Types
Recursive Relationships
An Entity is both the child and parent
Role name to be given for the migrated attribute
2008 MindTree Limited Slide 17
Additional Relationship Types
Subtype Relationships
Also termed as generalization category, generalization hierarchy or
inheritance hierarchy
To group a set of entities that share common characteristics
2008 MindTree Limited Slide 18
Additional Relationship Types
Sub type discriminator is used to distinguish the instances belonging to
each type. Its an attribute in the super type entity
2008 MindTree Limited Slide 19
Subject Areas
Data Model are divided into subject areas
Subject area defines specific areas of interest to individual business
functions
Subject Areas help reduce larger models into smaller manageable
subsets of entities
2008 MindTree Limited Slide 20
Notations
One to One
Zero to One
One to Many
Zero to Many
2008 MindTree Limited Slide 21
Logical Model to Physical Model
Logical Model is the base !!!!
2008 MindTree Limited Slide 22
Logical Model to Physical Model
Customizations like the following is done in the physical model
De-normalization
Database specific constructs and so on
Model then ready for deployment
Tools ERWin, Er Studio, Oracle Designer
2008 MindTree Limited Slide 23
Exercise
Design the database structures for C.V Raman
University

2008 MindTree Limited Slide 24
Other Information
ERwin Erwingsg.pdf
To learn about IDEF standards http://www.idef.com
Data Model Patterns David Hay
Corporate Data Model Standards and Guidelines -
http://srmwww.gov.bc.ca/risc/pubs/other/corporatestandards/
Corporate Data Model Framework -
http://srmwww.gov.bc.ca/risc/pubs/other/corporateframework/index.htm
Corporate Data Model - A Blast From the Past
http://www.dmreview.com/article_sub.cfm?articleId=877

2008 MindTree Consulting 2008 MindTree Limited 2008 MindTree Limited
Imagination Action Joy
www.mindtree.com
Aditya