Erd chapter 3
-
Upload
sonabir -
Category
Technology
-
view
379 -
download
0
Transcript of Erd chapter 3
![Page 1: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/1.jpg)
Chapter 3Chapter 3
Entity Relationship (E-Entity Relationship (E-R) ModelingR) Modeling
![Page 2: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/2.jpg)
2
In this chapter, you will In this chapter, you will learn:learn:
What a conceptual model is and what What a conceptual model is and what its purpose isits purpose is
The difference between internal and The difference between internal and external modelsexternal models
How internal and external models How internal and external models serve the database design processserve the database design process
How relationships between entities How relationships between entities are defined and refined, and how such are defined and refined, and how such relationships are incorporated into relationships are incorporated into the database design processthe database design process
How ERD components affect database How ERD components affect database design and implementationdesign and implementation
![Page 3: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/3.jpg)
3
Basic Modeling Basic Modeling ConceptsConcepts
Art and scienceArt and science Good judgment coupled with Good judgment coupled with
powerful design toolspowerful design tools ModelsModels
““Description or analogy used to Description or analogy used to visualize something that cannot be visualize something that cannot be directly observed” directly observed” Webster’s Webster’s DictionaryDictionary
![Page 4: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/4.jpg)
4
Basic Modeling Basic Modeling ConceptsConcepts
Data ModelData Model Relatively simple representation of Relatively simple representation of
complex real-world data structurescomplex real-world data structures Basic tools for database designBasic tools for database design AbstractionAbstraction Good database design starts with a Good database design starts with a
good design of data model.good design of data model.
![Page 5: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/5.jpg)
5
Basic Modeling Basic Modeling ConceptsConcepts
Data ModelData Model Different views of data and different Different views of data and different
concernsconcerns Communication is needed.Communication is needed. Impacts on overall management Impacts on overall management
system and policy, as well as decision system and policy, as well as decision make.make.
Blueprint, architecture, frameworkBlueprint, architecture, framework
![Page 6: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/6.jpg)
6
Data Models: Degrees of Data Data Models: Degrees of Data AbstractionAbstraction
Three different models Three different models (according to the degree of (according to the degree of abstract)abstract) Conceptual model
o Global view of dataGlobal view of datao Basis for identification and description of main Basis for identification and description of main
data itemsdata items Internal model
o Representation of database as seen by DBMSRepresentation of database as seen by DBMSo Adapts conceptual model to specific DBMSAdapts conceptual model to specific DBMS
External modelo Based on internal data modelBased on internal data modelo Users’ views of data environmentUsers’ views of data environmento Provides subsets of internal viewProvides subsets of internal view
Physical modelo Lowest level of abstractionLowest level of abstractiono Describe the ways data being storedDescribe the ways data being stored
![Page 7: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/7.jpg)
7
![Page 8: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/8.jpg)
8
The Entity Relationship The Entity Relationship (E-R) Model(E-R) Model
Represents conceptual viewRepresents conceptual view Main ComponentsMain Components
EntitiesEntities Corresponds to entire table, not rowCorresponds to entire table, not row Represented by rectangleRepresented by rectangle
AttributesAttributes RelationshipsRelationships
![Page 9: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/9.jpg)
9
What Should an Entity What Should an Entity Be?Be?
SHOULD BE:SHOULD BE: An object that will have many An object that will have many
instances in the databaseinstances in the database An object that will be composed of An object that will be composed of
multiple attributesmultiple attributes An object that we are trying to modelAn object that we are trying to model
SHOULD NOT BE:SHOULD NOT BE: A user of the database system A user of the database system An output of the database system (e.g. An output of the database system (e.g.
a report)a report)
![Page 10: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/10.jpg)
10
Inappropriate entities
System userSystem user System outputSystem output
Appropriate entities
Figure 3-4
![Page 11: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/11.jpg)
11
AttributesAttributes Characteristics of entitiesCharacteristics of entities Domain is set of possible valuesDomain is set of possible values Primary keys underlinedPrimary keys underlined
Figure 3.6
![Page 12: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/12.jpg)
12
![Page 13: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/13.jpg)
13
SimpleSimple Cannot be subdividedCannot be subdivided Age, sex, marital statusAge, sex, marital status
Composite (avoided)Composite (avoided) Can be subdivided into Can be subdivided into
additional attributesadditional attributes Address into street, city, zipAddress into street, city, zip
Single-valuedSingle-valued Can have only a single Can have only a single
valuevalue Person has one social Person has one social
security numbersecurity number
Multi-valued Multi-valued (avoid) in RDBMS(avoid) in RDBMS Can have many valuesCan have many values Person may have Person may have
several college several college degreesdegrees
How to avoid? (see How to avoid? (see next slide)next slide)
DerivedDerived Can be derived with Can be derived with
algorithm (Age can be algorithm (Age can be derived from date of derived from date of birth)birth)
Need to be storedNeed to be stored
![Page 14: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/14.jpg)
14
![Page 15: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/15.jpg)
15
![Page 16: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/16.jpg)
16
![Page 17: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/17.jpg)
17
![Page 18: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/18.jpg)
18
![Page 19: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/19.jpg)
19
RelationshipsRelationships Association between entitiesAssociation between entities Connected entities are called participantsConnected entities are called participants Operate in Operate in bothboth directions directions Connectivity describes relationship Connectivity describes relationship
classificationclassification 1:1, 1:M, M:N1:1, 1:M, M:N
CardinalityCardinality Expresses number of entity occurrences Expresses number of entity occurrences
associated with one occurrence of related entityassociated with one occurrence of related entity
![Page 20: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/20.jpg)
20
Connectivity and Cardinality in an ERDConnectivity and Cardinality in an ERD
Figure 3.12
![Page 21: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/21.jpg)
Relationship Relationship ParticipationParticipation
![Page 22: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/22.jpg)
22
Relationship StrengthRelationship Strength Existence dependenceExistence dependence
Entity’s existence depends on existence Entity’s existence depends on existence of related entitiesof related entities
Existence-independent entities can exist Existence-independent entities can exist apart from related entitiesapart from related entities
Example:Example:
![Page 23: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/23.jpg)
23
Relationship StrengthRelationship Strength Weak (non-identifying)Weak (non-identifying)
One entity is existence-independent on One entity is existence-independent on anotheranother
PK of related entity doesn’t contain PK PK of related entity doesn’t contain PK component of parent entitycomponent of parent entity
Strong (identifying)Strong (identifying) One entity is existence-dependent on One entity is existence-dependent on
anotheranother PK of related entity contains PK PK of related entity contains PK
component of parent entity component of parent entity
![Page 24: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/24.jpg)
24
![Page 25: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/25.jpg)
25
![Page 26: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/26.jpg)
26
Weak EntityWeak Entity Existence-dependent on another Existence-dependent on another
entityentity Has primary key that is partially Has primary key that is partially
or totally or totally
derived from parent entityderived from parent entity
Figure 3.19
![Page 27: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/27.jpg)
27
Relationship DegreeRelationship Degree Indicates number of associated entitiesIndicates number of associated entities UnaryUnary
Single entitySingle entity RecursiveRecursive Exists between occurrences of same entity setExists between occurrences of same entity set
BinaryBinary Two entities associatedTwo entities associated
TernaryTernary Three entities associatedThree entities associated
![Page 28: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/28.jpg)
28
Three Types of Three Types of RelationshipsRelationships
Figure 3.21
![Page 29: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/29.jpg)
29
![Page 30: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/30.jpg)
30
Composite EntitiesComposite Entities
Used to ‘bridge’ between M:N Used to ‘bridge’ between M:N relationshipsrelationships
Bridge entities composed of Bridge entities composed of primary keys of each entity primary keys of each entity needing connectionneeding connection
Figure 3.30
![Page 31: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/31.jpg)
31
Composite Entities Composite Entities (con’t.)(con’t.)
Figure 3.31
![Page 32: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/32.jpg)
32
Entity Supertypes and Entity Supertypes and SubtypesSubtypes
Generalization hierarchy Generalization hierarchy Depicts relationships between higher-Depicts relationships between higher-
level supertype and lower-level subtype level supertype and lower-level subtype entitiesentities
Supertype has shared attributesSupertype has shared attributes Subtypes have unique attributesSubtypes have unique attributes Disjoint relationshipsDisjoint relationships
Unique subtypesUnique subtypes Non-overlappingNon-overlapping Indicated with a ‘G’Indicated with a ‘G’
Overlapping subtypes use ‘Gs’ SymbolOverlapping subtypes use ‘Gs’ Symbol
![Page 33: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/33.jpg)
33
![Page 34: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/34.jpg)
34
![Page 35: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/35.jpg)
35
![Page 36: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/36.jpg)
36
Generalization Generalization Hierarchy with Hierarchy with
Overlapping SubtypesOverlapping Subtypes
Figure 3.35
![Page 37: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/37.jpg)
37
Developing an E-R Developing an E-R DiagramDiagram
Iterative ProcessIterative Process Step1: General narrative of Step1: General narrative of
organizational operations developedorganizational operations developed Step2: Basic E-R Model graphically Step2: Basic E-R Model graphically
depicted and revieweddepicted and reviewed Step3: Modifications made to incorporate Step3: Modifications made to incorporate
newly discovered E-R componentsnewly discovered E-R components Repeat process until designers and Repeat process until designers and
users agree E-R Diagram completeusers agree E-R Diagram complete
![Page 38: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/38.jpg)
38
Supertype/Subtype Supertype/Subtype Relationship in an ERD Relationship in an ERD
![Page 39: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/39.jpg)
39
![Page 40: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/40.jpg)
40
![Page 41: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/41.jpg)
41
First ERD Segment First ERD Segment Established Established
Figure 3.43
![Page 42: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/42.jpg)
42
Second and Third ERD Second and Third ERD Segments Established Segments Established
![Page 43: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/43.jpg)
43
Fourth and Fifth ERD Fourth and Fifth ERD Segments Established Segments Established
![Page 44: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/44.jpg)
44
Sixth and Seventh ERD Sixth and Seventh ERD Segments Established Segments Established
![Page 45: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/45.jpg)
45
Eighth ERD Eighth ERD Segment Established Segment Established
![Page 46: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/46.jpg)
46
Ninth ERD Ninth ERD Segment Established Segment Established
Figures 3.51
![Page 47: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/47.jpg)
47
Components of E-R Components of E-R ModelModel
Table 3.2
![Page 48: Erd chapter 3](https://reader035.fdocuments.net/reader035/viewer/2022062303/5563a2add8b42a2d538b5351/html5/thumbnails/48.jpg)
48
Completed ERDCompleted ERD
Figure 3.52