Вы находитесь на странице: 1из 59

CHAPTERCHAPTER 2:2:

MODELINGMODELING DATADATA ININ THETHE ORGANIZATIONORGANIZATION

Modern Database Management 11 th Edition

Jeffrey A. Hoffer, V. Ramesh, Heikki Topi

© 2013 Pearson Education, Inc. Publishing as Prentice Hall

1

OBJECTIVESOBJECTIVES

DefineDefine termsterms

UnderstandUnderstand importanceimportance ofof datadata modelingmodeling

WriteWrite goodgood namesnames andand definitionsdefinitions forfor entities,entities, relationships,relationships, andand attributesattributes

DistinguishDistinguish unary,unary, binary,binary, andand ternaryternary relationshipsrelationships

ModelModel differentdifferent typestypes ofof attributes,attributes, entities,entities, relationships,relationships, andand cardinalitiescardinalities

DrawDraw E-RE-R diagramsdiagrams forfor commoncommon businessbusiness situationssituations

ConvertConvert many-to-manymany-to-many relationshipsrelationships toto associativeassociative entitiesentities

ModelModel time-dependenttime-dependent datadata usingusing timetime stampsstamps

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

2

 A database must mirror the real world if it is to answer questions about

A database must mirror the real world if it is to answer questions about the real world Data Modeling is a design technique for capturing reality

STUDENT Social_Security_No Name Major
STUDENT
Social_Security_No
Name
Major
capturing reality STUDENT Social_Security_No Name Major C h a p t e r 2 © ©

AA GOODGOOD DATADATA NAMENAME IS:IS:

RelatedRelated toto business,business, notnot technical,technical, characteristicscharacteristics

MeaningfulMeaningful andand self-documentingself-documenting

UniqueUnique

ReadableReadable

ComposedComposed ofof wordswords fromfrom anan approvedapproved listlist

RepeatableRepeatable

WrittenWritten inin standardstandard syntaxsyntax

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

4

DATADATA DEFINITIONSDEFINITIONS

ExplanationExplanation ofof aa termterm oror factfact

Term–wordTerm–word oror phrasephrase withwith specificspecific meaningmeaning Fact–associationFact–association betweenbetween twotwo oror moremore termsterms

GuidelinesGuidelines forfor goodgood datadata definitiondefinition

AA conciseconcise descriptiondescription ofof essentialessential datadata meaningmeaning

GatheredGathered inin conjunctionconjunction withwith systemssystems requirementsrequirements

AccompaniedAccompanied byby diagramsdiagrams

AchievedAchieved byby consensus,consensus, andand iterativelyiteratively refinedrefined

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

5

E-RE-R MODELMODEL CONSTRUCTSCONSTRUCTS

Entities:Entities:

EntityEntity instance–person,instance–person, place,place, object,object, event,event, conceptconcept (often(often correspondscorresponds toto aa rowrow inin aa table)table)

EntityEntity Type–collectionType–collection ofof entitiesentities (often(often correspondscorresponds toto aa table)table)

Relationships:Relationships:

RelationshipRelationship instance–linkinstance–link betweenbetween entitiesentities (corresponds(corresponds toto primaryprimary key-foreignkey-foreign keykey equivalenciesequivalencies inin relatedrelated tables)tables)

RelationshipRelationship type–categorytype–category ofof relationship…linkrelationship…link betweenbetween entityentity typestypes

Attributes:Attributes:

PropertiesProperties oror characteristicscharacteristics ofof anan entityentity oror relationshiprelationship typetype (often(often correspondscorresponds toto aa fieldfield inin aa table)table)

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

6

Sample E-R Diagram (Figure 2-1)

Sample E-R Diagram (Figure 2-1) C h a p t e r 2 © © 2013

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

7 7

Basic E-R notation (Figure 2-2)

Basic E-R notation (Figure 2-2) Entity symbols Attribute symbols A special entity that is also a
Basic E-R notation (Figure 2-2) Entity symbols Attribute symbols A special entity that is also a

Entity

symbols

Attribute

symbols

E-R notation (Figure 2-2) Entity symbols Attribute symbols A special entity that is also a relationship

A special entity that is also a relationship

Relationship

symbols

entity that is also a relationship Relationship symbols Relationship degrees specify number of entity types involved

Relationship degrees specify number of entity types involved

Relationship cardinalities specify how many of each entity type is allowed

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

8 8

ENTITY ATTRIBUTE RELATIONSHIP MULTIVALUED ATTRIBUTE INDENTIFYING RELATIONSHIP *Actually somewhat modified Chen.

ENTITY

ATTRIBUTE
ATTRIBUTE
RELATIONSHIP
RELATIONSHIP
ENTITY ATTRIBUTE RELATIONSHIP MULTIVALUED ATTRIBUTE INDENTIFYING RELATIONSHIP *Actually somewhat modified Chen.
MULTIVALUED ATTRIBUTE
MULTIVALUED
ATTRIBUTE
INDENTIFYING RELATIONSHIP
INDENTIFYING
RELATIONSHIP

*Actually somewhat modified Chen.

ASSOCIATIVE ENTITY
ASSOCIATIVE
ENTITY
DERIVED ATTRIBUTE
DERIVED
ATTRIBUTE
modified Chen. ASSOCIATIVE ENTITY DERIVED ATTRIBUTE C h a p t e r 2 © ©

BUSINESSBUSINESS RULESRULES

AreAre statementsstatements thatthat definedefine oror constrainconstrain somesome aspectaspect ofof thethe businessbusiness

AreAre derivedderived fromfrom policies,policies, procedures,procedures, events,events, functionsfunctions

AssertAssert businessbusiness structurestructure

Control/influenceControl/influence businessbusiness behaviorbehavior

AreAre expressedexpressed inin termsterms familiarfamiliar toto endend usersusers

AreAre automatedautomated throughthrough DBMSDBMS softwaresoftware

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

10

AA GOODGOOD BUSINESSBUSINESS RULERULE IS:IS:

Declarative–what,Declarative–what, notnot howhow

Precise–clear,Precise–clear, agreed-uponagreed-upon meaningmeaning Atomic–oneAtomic–one statementstatement

Consistent–internallyConsistent–internally andand externallyexternally

Expressible–structured,Expressible–structured, naturalnatural languagelanguage

Distinct–non-redundantDistinct–non-redundant

Business-oriented–understoodBusiness-oriented–understood byby businessbusiness peoplepeople

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

11

ENTITIESENTITIES

EntityEntity aa person,person, aa place,place, anan object,object, anan event,event, oror aa conceptconcept inin thethe useruser environmentenvironment aboutabout whichwhich thethe organizationorganization wisheswishes toto maintainmaintain datadata EntityEntity typetype aa collectioncollection ofof entitiesentities thatthat shareshare commoncommon propertiesproperties oror characteristicscharacteristics EntityEntity instanceinstance AA singlesingle occurrenceoccurrence ofof anan entityentity typetype

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

12

ENTITYENTITY TYPETYPE ANDAND ENTITYENTITY INSTANCESINSTANCES

TYPE TYPE AND AND ENTITY ENTITY INSTANCES INSTANCES C h a p t e r 2

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

13

ANAN ENTITY…ENTITY…

SHOULDSHOULD BE:BE:

AnAn objectobject thatthat willwill havehave manymany instancesinstances inin thethe databasedatabase

AnAn objectobject thatthat willwill bebe composedcomposed ofof multiplemultiple attributesattributes

AnAn objectobject thatthat wewe areare tryingtrying toto modelmodel

SHOULDSHOULD NOTNOT BE:BE:

AA useruser ofof thethe databasedatabase systemsystem

AnAn outputoutput ofof thethe databasedatabase systemsystem (e.g.,(e.g., aa report)report)

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

14

Figure 2-4 Example of inappropriate entities

SystemSystem

useruser

Chapter 2

Inappropriate entities
Inappropriate
entities

SystemSystem

outputoutput

Appropriate

entities

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

15

STRONGSTRONG VS.VS. WEAKWEAK ENTITIES,ENTITIES, ANDAND IDENTIFYINGIDENTIFYING RELATIONSHIPSRELATIONSHIPS

StrongStrong entityentity

existsexists independentlyindependently ofof otherother typestypes ofof entitiesentities

hashas itsits ownown uniqueunique identifieridentifier

identifieridentifier underlinedunderlined withwith singlesingle lineline

WeakWeak entityentity

dependentdependent onon aa strongstrong entityentity (identifying(identifying owner)…cannotowner)…cannot existexist onon itsits ownown

doesdoes notnot havehave aa uniqueunique identifieridentifier (only(only aa partialpartial identifier)identifier)

entityentity boxbox andand partialpartial identifieridentifier havehave doubledouble lineslines

IdentifyingIdentifying relationshiprelationship

linkslinks strongstrong entitiesentities toto weakweak entitiesentities

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

16

Figure 2-5 Example of a weak identity and its identifying relationship

Example of a weak identity and its identifying relationship Strong entity Weak entity C h a

Strong entity

Weak entity

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

17

ATTRIBUTESATTRIBUTES

Attribute–propertyAttribute–property oror characteristiccharacteristic ofof anan entityentity oror relationshiprelationship typetype ClassificationsClassifications ofof attributes:attributes:

RequiredRequired versusversus OptionalOptional AttributesAttributes SimpleSimple versusversus CompositeComposite AttributeAttribute Single-ValuedSingle-Valued versusversus MultivaluedMultivalued AttributeAttribute StoredStored versusversus DerivedDerived AttributesAttributes IdentifierIdentifier AttributesAttributes

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

18

REQUIREDREQUIRED VS.VS. OPTIONALOPTIONAL ATTRIBUTESATTRIBUTES

REQUIRED VS. VS. OPTIONAL OPTIONAL ATTRIBUTES ATTRIBUTES Required – must have a value for every entity

Required – must have a value for every entity (or relationship) instance with which it is associated

Optional – may not have a value for every entity (or relationship) instance with which it is associated

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

19

SIMPLESIMPLE VS.VS. COMPOSITECOMPOSITE ATTRIBUTESATTRIBUTES

CompositeComposite attributeattribute AnAn attributeattribute thatthat hashas meaningfulmeaningful componentcomponent partsparts (attributes)(attributes)

component component parts parts (attributes) (attributes) The address is broken into component parts Figure 2-7 A

The address is broken into component parts

(attributes) The address is broken into component parts Figure 2-7 A composite attribute C h a

Figure 2-7 A composite attribute

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

20

Multi-valuedMulti-valued andand DerivedDerived AttributesAttributes

Multivalued – may take on more than one value for a given entity (or relationship) instance

Derived – values can be calculated from related attribute values (not physically stored in the database)

Figure 2-8 Entity with multivalued attribute (Skill) and derived attribute (Years Employed)

attribute (Skill) and derived attribute (Years Employed) Multivalued an employee can have more than one skill

Multivalued an employee can have more than one skill

Derived Calculated from date employed and current date

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

21 21

IDENTIFIERSIDENTIFIERS (KEYS)(KEYS)

IdentifierIdentifier (Key)–an(Key)–an attributeattribute (or(or combinationcombination ofof attributes)attributes) thatthat uniquelyuniquely identifiesidentifies individualindividual instancesinstances ofof anan entityentity typetype SimpleSimple versusversus CompositeComposite IdentifierIdentifier CandidateCandidate Identifier–anIdentifier–an attributeattribute thatthat couldcould bebe aa key…satisfieskey…satisfies thethe requirementsrequirements forfor beingbeing anan identifieridentifier

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

22

CRITERIACRITERIA FORFOR IDENTIFIERSIDENTIFIERS

ChooseChoose IdentifiersIdentifiers thatthat

WillWill notnot changechange inin valuevalue WillWill notnot bebe nullnull

AvoidAvoid intelligentintelligent identifiersidentifiers (e.g.,(e.g., containingcontaining locationslocations oror peoplepeople thatthat mightmight change)change) SubstituteSubstitute new,new, simplesimple keyskeys forfor long,long, compositecomposite keyskeys

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

23

Figure 2-9 Simple and composite identifier attributes

Figure 2-9 Simple and composite identifier attributes The identifier is boldfaced and underlined C h a
Figure 2-9 Simple and composite identifier attributes The identifier is boldfaced and underlined C h a
Figure 2-9 Simple and composite identifier attributes The identifier is boldfaced and underlined C h a

The identifier is boldfaced and underlined

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

24 24

NAMINGNAMING ATTRIBUTESATTRIBUTES

NameName shouldshould bebe aa singularsingular nounnoun oror nounnoun phrasephrase NameName shouldshould bebe uniqueunique NameName shouldshould followfollow aa standardstandard formatformat

e.g.e.g. [Entity[Entity typetype namename {{ [[ QualifierQualifier ]] }} ]] ClassClass

SimilarSimilar attributesattributes ofof differentdifferent entityentity typestypes shouldshould useuse thethe samesame qualifiersqualifiers andand classesclasses

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

25

DEFININGDEFINING ATTRIBUTESATTRIBUTES

StateState whatwhat thethe attributeattribute isis andand possiblypossibly whywhy itit isis importantimportant

MakeMake itit clearclear whatwhat isis andand isis notnot includedincluded inin thethe attribute’sattribute’s valuevalue

IncludeInclude aliasesaliases inin documentationdocumentation

StateState sourcesource ofof valuesvalues

SpecifySpecify requiredrequired vs.vs. optionaloptional

StateState minmin andand maxmax numbernumber ofof occurrencesoccurrences allowedallowed

IndicateIndicate relationshipsrelationships withwith otherother attributesattributes

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

26

MODELINGMODELING RELATIONSHIPSRELATIONSHIPS

RelationshipRelationship TypesTypes vs.vs. RelationshipRelationship InstancesInstances

TheThe relationshiprelationship typetype isis modeledmodeled asas lineslines betweenbetween entityentity types…thetypes…the instanceinstance isis betweenbetween specificspecific entityentity instancesinstances

RelationshipsRelationships cancan havehave attributesattributes

TheseThese describedescribe featuresfeatures pertainingpertaining toto thethe associationassociation betweenbetween thethe entitiesentities inin thethe relationshiprelationship

TwoTwo entitiesentities cancan havehave moremore thanthan oneone typetype ofof relationshiprelationship betweenbetween themthem (multiple(multiple relationships)relationships)

AssociativeAssociative Entity–combinationEntity–combination ofof relationshiprelationship andand entityentity

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

27

Figure 2-10 Relationship types and instances

a) Relationship type (Completes)

b) Relationship instances

a) Relationship type (Completes) b) Relationship instances C h a p t e r 2 ©

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

28 28

DEGREEDEGREE OFOF RELATIONSHIPSRELATIONSHIPS

DegreeDegree ofof aa relationshiprelationship isis thethe numbernumber ofof entityentity typestypes thatthat participateparticipate inin itit

UnaryUnary RelationshipRelationship BinaryBinary RelationshipRelationship TernaryTernary RelationshipRelationship

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

29

Degree of relationships – from Figure 2-2

Degree of relationships – from Figure 2-2 One entity related to another of the same entity

One entity related to another of the same entity type

Entities of

two different types related

to each other

Entities of three different types related to each other

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

30 30

CARDINALITYCARDINALITY OFOF RELATIONSHIPSRELATIONSHIPS

One-to-OneOne-to-One

EachEach entityentity inin thethe relationshiprelationship willwill havehave exactlyexactly oneone relatedrelated entityentity

One-to-ManyOne-to-Many

AnAn entityentity onon oneone sideside ofof thethe relationshiprelationship cancan havehave manymany relatedrelated entities,entities, butbut anan entityentity onon thethe otherother sideside willwill havehave aa maximummaximum ofof oneone relatedrelated entityentity

Many-to-ManyMany-to-Many

EntitiesEntities onon bothboth sidessides ofof thethe relationshiprelationship cancan havehave manymany relatedrelated entitiesentities onon thethe otherother sideside

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

31

Figure 2-12 Examples of relationships of different degrees

a) Unary relationships

of relationships of different degrees a) Unary relationships C h a p t e r 2

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

32 32

Figure 2-12 Examples of relationships of different degrees (cont.)

b) Binary relationships

of different degrees (cont.) b) Binary relationships C h a p t e r 2 ©

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

33 33

Figure 2-12 Examples of relationships of different degrees (cont.)

c) Ternary relationship

of different degrees (cont.) c) Ternary relationship Note: a relationship can have attributes of its own

Note: a relationship can have attributes of its own

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

34 34

CARDINALITYCARDINALITY CONSTRAINTSCONSTRAINTS

CardinalityCardinality Constraints—theConstraints—the numbernumber ofof instancesinstances ofof oneone entityentity thatthat cancan oror mustmust bebe associatedassociated withwith eacheach instanceinstance ofof anotheranother entityentity MinimumMinimum CardinalityCardinality

IfIf zero,zero, thenthen optionaloptional IfIf oneone oror more,more, thenthen mandatorymandatory

MaximumMaximum CardinalityCardinality

TheThe maximummaximum numbernumber

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

35

Figure 2-17 Examples of cardinality constraints

a) Mandatory cardinalities

of cardinality constraints a) Mandatory cardinalities A patient must have recorded at least one history, and
of cardinality constraints a) Mandatory cardinalities A patient must have recorded at least one history, and
of cardinality constraints a) Mandatory cardinalities A patient must have recorded at least one history, and

A patient must have recorded at least one history, and can have many

A patient history is recorded for one and only one patient

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

36 36

Figure 2-17 Examples of cardinality constraints (cont.)

b) One optional, one mandatory

constraints (cont.) b) One optional, one mandatory An employee can be assigned to any number of
constraints (cont.) b) One optional, one mandatory An employee can be assigned to any number of

An employee can be assigned to any number of projects, or may not be assigned to any at all

A project must be assigned to at least one employee, and may be assigned to many

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

37 37

Figure 2-17 Examples of cardinality constraints (cont.)

c) Optional cardinalities

of cardinality constraints (cont.) c) Optional cardinalities A person is married to at most one other

A person is married to at most one other person, or may not be married at all

to at most one other person, or may not be married at all C h a

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

38 38

Figure 2-21 Examples of multiple relationships

a) Employees and departments

of multiple relationships a) Employees and departments Entities can be related to one another in more

Entities can be related to one another in more than one way

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

39 39

Figure 2-21 Examples of multiple relationships (cont.)

b) Professors and courses (fixed lower limit constraint)

b) Professors and courses (fixed lower limit constraint) Here, min cardinality constraint is 2. At least

Here, min cardinality constraint is 2. At least two professors must be qualified to teach each course. Each professor must be qualified to teach at least one course.

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

40 40

Figure 2-15a and 2-15b Multivalued attributes can be represented as relationships

simple
simple
composite
composite

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

41 41

ASSOCIATIVEASSOCIATIVE ENTITIESENTITIES

AnAn entity–hasentity–has attributesattributes

ANDAND it’sit’s aa relationship–linksrelationship–links entitiesentities togethertogether

WhenWhen shouldshould aa relationshiprelationship withwith attributesattributes insteadinstead bebe anan associativeassociative entityentity??

AllAll relationshipsrelationships forfor thethe associativeassociative entityentity shouldshould bebe manymany

TheThe associativeassociative entityentity couldcould havehave meaningmeaning independentindependent ofof thethe otherother entitiesentities

TheThe associativeassociative entityentity preferablypreferably hashas aa uniqueunique identifier,identifier, andand shouldshould alsoalso havehave otherother attributesattributes

TheThe associativeassociative entityentity maymay participateparticipate inin otherother relationshipsrelationships otherother thanthan thethe entitiesentities ofof thethe associatedassociated relationshiprelationship

TernaryTernary relationshipsrelationships shouldshould bebe convertedconverted toto associativeassociative entitiesentities

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

42

Associative entity is like a relationship with an attribute, but it is also considered to
Associative entity is like a relationship with an attribute, but it is also considered to

Associative entity is like a relationship with an attribute, but it is also considered to be an entity in its own right.

Associative entity involves a rectangle with a diamond inside. Note that the many-to-many cardinality symbols
Associative entity involves a rectangle with a diamond inside. Note that the many-to-many cardinality symbols

Associative entity involves a rectangle with a diamond inside. Note that the many-to-many cardinality symbols face toward the associative entity and not toward the other entities

Figure 2-13c An associative entity – bill of materials structure

2-13c An associative entity – bill of materials structure This could just be a relationship with

This could just be a relationship with attributes…it’s a judgment call.

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

45 45

This is the Bill of Materials laid out a different way. It could just be
This is the Bill of Materials laid out a different way. It could just be

This is the Bill of Materials laid out a different way. It could just be a relationship with attributes…it’s a judgment call

be a relationship with attributes…it’s a judgment call C h a p t e r 2

Figure 2-11a A binary relationship with an attribute

Figure 2-11a A binary relationship with an attribute Here, the date completed attribute pertains specifically to

Here, the date completed attribute pertains specifically to the employee’s completion of a course…it is an attribute of the relationship.

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

47 47

Figure 2-11b An associative entity (CERTIFICATE)

Figure 2-11b An associative entity (CERTIFICATE) Associative entity is like a relationship with an attribute, but

Associative entity is like a relationship with an attribute, but it is also considered to be an entity in its own right.

Note that the many-to-many cardinality between entities in Figure 2-11a has been replaced by two one-to-many relationships with the associative entity.

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

48 48

Figure 2-19 Simple example of time-stamping

Figure 2-19 Simple example of time-stamping Time stamp – a time value that is associated with

Time stamp – a time value that is associated with a data value, often indicating when some event occurred that affected the data value

The Price History attribute is both multivalued and composite.

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

49 49

Figure 2-20c E-R diagram with associative entity for product assignment to product line over time

entity for product assignment to product line over time Modeling time-dependent data has become more important

Modeling time-dependent data has become more important due to regulations such as HIPAA and Sarbanes-Oxley.

The Assignment associative entity shows the date range of a product’s assignment to a particular product line.

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

50 50

C h a p t e r 2 © © 2013 2013 Pearson Pearson Education,
C h a p t e r 2 © © 2013 2013 Pearson Pearson Education,
C h a p t e r 2 © © 2013 2013 Pearson Pearson Education,
Figure 2-22 Data model for Pine Valley Furniture Company in Microsoft Visio notation Different modeling

Figure 2-22 Data model for Pine Valley Furniture Company in Microsoft Visio notation

Different modeling software tools may have different notation for the same constructs.

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

52 52

C h a p t e r 2 © © 2013 2013 Pearson Pearson Education,
CUSTOMER ORDER * Order ID Order Date * Customer ID Customer name C h a

CUSTOMER

ORDER

* Order ID Order DateCUSTOMER ORDER * Customer ID Customer name CUSTOMER ORDER * Customer ID Customer name

* Customer ID Customer name

* Order ID Order Date * Customer ID Customer name C h a p t e
CUSTOMER 1 SUBMITS M ORDER Customer ID Customer name Order ID Order date C h
CUSTOMER 1 SUBMITS M ORDER
CUSTOMER
1
SUBMITS
M
ORDER

Customer ID

Customer name

Order ID

Order date

M ORDER Customer ID Customer name Order ID Order date C h a p t e
CUSTOMER #Customer_ID *Customer Name ORDER #Order_ID *Order Date C h a p t e r
CUSTOMER #Customer_ID *Customer Name ORDER #Order_ID *Order Date
CUSTOMER #Customer_ID *Customer Name ORDER #Order_ID *Order Date
CUSTOMER #Customer_ID *Customer Name ORDER #Order_ID *Order Date

CUSTOMER #Customer_ID *Customer Name

CUSTOMER #Customer_ID *Customer Name
CUSTOMER #Customer_ID *Customer Name ORDER #Order_ID *Order Date

ORDER

#Order_ID *Order DateCUSTOMER #Customer_ID *Customer Name ORDER CUSTOMER #Customer_ID *Customer Name ORDER

#Order_ID *Order Date
CUSTOMER #Customer_ID *Customer Name ORDER #Order_ID *Order Date
CUSTOMER #Customer_ID *Customer Name ORDER #Order_ID *Order Date
*Customer Name ORDER #Order_ID *Order Date C h a p t e r 2 © ©
C h a p t e r 2 © © 2013 2013 Pearson Pearson Education,
C h a p t e r 2 © © 2013 2013 Pearson Pearson Education,
C h a p t e r 2 © © 2013 2013 Pearson Pearson Education,

Chapter 2

©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

58

Copyright Copyright © © 2013 2013 Pearson Pearson Education, Education, Inc. Inc. Publishing Publishing as

CopyrightCopyright ©© 20132013 PearsonPearson Education,Education, Inc.Inc. PublishingPublishing asas PrenticePrentice HallHall

5959