Top Banner
Stephen C. Hayne Data Modeling Method identify/describe data entities Notation way to illustrate findings Approaches Normalization Entity Relationship
28

Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Mar 26, 2015

Download

Documents

Destiny Warren
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

Data Modeling

Method identify/describe data entities

Notation way to illustrate findings

Approaches Normalization Entity Relationship

Page 2: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Entity Relationship Model

Strong and weak entity typesAttributesBinary relationshipsDesign problemsRecursion and generalization

Page 3: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

Basic concepts

Entity identifiable object or concept

Attribute property of an entity or relationship

Relationship an association among entities

Identifier one or more attributes identifying an

instance of an entity

Page 4: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

Entity (or entity class) vs. entity instance

Page 5: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

Entity types

Strong existence does not depend on the existence

of another entity

Weak existence is dependent on the existence of

another entity business rules vs. logical dependence ID-dependence (physical dependence)

Page 6: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

Entity-Relationship Model

Relationship

Identifying Relationship

Entity

Weak Entity

Page 7: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

Entity examples

Staff

Branch

Nextof Kin

Room

Which are strong, weak, ID-dependent entities?

Page 8: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

Attributes or properties

DORMITORY

Location

DormName

Number of Rooms

DORMITORYDormNameLocationNumber of Rooms

Page 9: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

Identifiers

Non-unique LastName

Unique (key) SSN

Composite {AreaCode, LocalNumber} (is this unique?)

Page 10: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

Binary relationships: HAS-A

IsAssigned

Occupies

BelongsTo

Page 11: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

Binary Relationship

Student Class0:N 0:35IsEnrolledIn

PartialParticipation

Page 12: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

Binary Relationship

Student Class1:N 1:NIsEnrolledIn

TotalParticipation

Page 13: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

Ternary relationships

Can often (always) split one relationship of degree 3 into two (three) relationships of degree 2; are these independent?...

Page 14: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

More on relationships

Relationship classes vs. instancesRelationships can have attributes

(equivalent to degree=3)Crow’s feet representation of cardinality

Rent

Page 15: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

Cardinality

Number of elements allowed on each side of a relationship (participants)

Maximum Cardinality Maximum number of entities that can be involved

in relationship: typically 1 or many

Minimum Cardinality Minimum number of entities that MUST be involved

in relationship : typically 0 or 1 Also called participation constraints: total or partial

Page 16: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

Cardinality constraints

PROPERTYOWNER 1:N

Owns

AUTOEMPLOYEE 1:1

Assigned

CLUBSTUDENT N:M

Joins

Page 17: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

Fan trapsMultiple 1:N relationships from the same entity

where a relationship between child entities is required

Solve it!

Page 18: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

Fan traps

Solution

Page 19: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

Chasm traps

Missing a required pathway between entitiesSingle line: partial participationSolve it!

Page 20: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

Chasm traps

Solution

Page 21: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

Recursive relationships

Participants are instances of same class

Page 22: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

Recursive Relationship

VolunteerSupervisor

Supervisee

Supervises

Role Name

0:N

1:1

Page 23: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

Weak relationship

Relationships involving weak entities Logical dependency

ID-dependency

Page 24: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

A full E-R diagram example

Properties can be shown in the diagram or listed separately

Page 25: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

Supertype & subtype entities

Exclusive vs. non-exclusive subtypesRequired vs. optional subtypes

Page 26: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

Generalization hierarchy

Represented by supertypes & subtypes

Also called: type hierarchy IS-A relationships

Inheritance subtype entities inherit

attributes of supertype entity

Page 27: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

Putting it together

Add business rules Constraints, restrictions, protocols Document the rules

Evaluate your data model! What queries can you pose? Are there any connection traps? Does it model the users’ model of the business

world?

Page 28: Stephen C. Hayne Data Modeling zMethod yidentify/describe data entities zNotation yway to illustrate findings zApproaches yNormalization yEntity Relationship.

Stephen C. Hayne

•Form pairs•Find:

•1 business rule•1 query

•Share