Entity Relationship (ER) Modeling
description
Transcript of Entity Relationship (ER) Modeling
![Page 1: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/1.jpg)
Entity Relationship (ER) Modeling
![Page 2: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/2.jpg)
The Entity Relationship Model (ERM)
Database Systems, 9th Edition2
ER model forms the basis of an ER diagramERD represents conceptual database as
viewed by end userERDs depict database’s main components:
EntitiesAttributesRelationships
![Page 3: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/3.jpg)
Entities
Database Systems, 9th Edition3
Refers to entity set and not to single entity occurrence
Corresponds to table and not to row in relational environment
In Chen and Crow’s Foot models, entity is represented by rectangle with entity’s name
Entity name, a noun, written in capital letters
![Page 4: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/4.jpg)
Keys
Database Systems, 9th Edition4
Each row in a table must be uniquely identifiable
Key is one or more attributes that determine other attributes
Key’s role is based on determinationIf you know the value of attribute A, you can
determine the value of attribute BFunctional dependence
Attribute B is functionally dependent on A if all rows in table that agree in value for A also agree in value for B
![Page 5: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/5.jpg)
Database Systems, 9th Edition5
![Page 6: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/6.jpg)
Keys (cont’d.)
Database Systems, 9th Edition6
Composite keyComposed of more than one attribute
Key attributeAny attribute that is part of a key
SuperkeyAny key that uniquely identifies each row
Candidate key A superkey without unnecessary attributes
![Page 7: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/7.jpg)
Keys (cont’d.)
Database Systems, 9th Edition7
NullsNo data entryNot permitted in primary keyShould be avoided in other attributesCan represent:
An unknown attribute valueA known, but missing, attribute valueA “not applicable” condition
![Page 8: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/8.jpg)
Keys (cont’d.)
Database Systems, 9th Edition8
Nulls (cont’d.)Can create problems when functions such as
COUNT, AVERAGE, and SUM are usedCan create logical problems when relational
tables are linked
![Page 9: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/9.jpg)
Database Systems, 9th Edition9
![Page 10: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/10.jpg)
Attributes
Database Systems, 9th Edition10
Characteristics of entitiesChen notation: attributes represented by
ovals connected to entity rectangle with a lineEach oval contains the name of attribute it
representsCrow’s Foot notation: attributes written in
attribute box below entity rectangle
![Page 11: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/11.jpg)
Database Systems, 9th Edition11
![Page 12: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/12.jpg)
Attributes (cont’d.)
Database Systems, 9th Edition12
Required attribute: must have a valueOptional attribute: may be left emptyDomain: set of possible values for an
attributeAttributes may share a domain
Identifiers: one or more attributes that uniquely identify each entity instance
Composite identifier: primary key composed of more than one attribute
![Page 13: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/13.jpg)
Attributes (cont’d.)
Database Systems, 9th Edition13
Composite attribute can be subdividedSimple attribute cannot be subdividedSingle-value attribute can have only a
single valueMultivalued attributes can have many
values
![Page 14: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/14.jpg)
Database Systems, 9th Edition14
![Page 15: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/15.jpg)
Attributes (cont’d.)
Database Systems, 9th Edition15
M:N relationships and multivalued attributes should not be implementedCreate several new attributes for each of the
original multivalued attributes’ componentsCreate new entity composed of original
multivalued attributes’ componentsDerived attribute: value may be
calculated from other attributesNeed not be physically stored within
database
![Page 16: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/16.jpg)
Database Systems, 9th Edition16
![Page 17: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/17.jpg)
Relationships
Database Systems, 9th Edition17
Association between entitiesParticipants are entities that participate
in a relationshipRelationships between entities always
operate in both directionsRelationship can be classified as 1:MRelationship classification is difficult to
establish if only one side of the relationship is known
![Page 18: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/18.jpg)
Connectivity and Cardinality
Database Systems, 9th Edition18
Connectivity Describes the relationship classification
Cardinality Expresses minimum and maximum number
of entity occurrences associated with one occurrence of related entity
Established by very concise statements known as business rules
![Page 19: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/19.jpg)
Database Systems, 9th Edition19
![Page 20: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/20.jpg)
Existence Dependence
Database Systems, 9th Edition20
Existence dependenceEntity exists in database only when it is
associated with another related entity occurrence
Existence independenceEntity can exist apart from one or more
related entitiesSometimes such an entity is referred to as a
strong or regular entity
![Page 21: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/21.jpg)
Relationship Strength
Database Systems, 9th Edition21
Weak (non-identifying) relationshipsExists if PK of related entity does not contain
PK component of parent entityStrong (identifying) relationships
Exists when PK of related entity contains PK component of parent entity
![Page 22: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/22.jpg)
Database Systems, 9th Edition22
![Page 23: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/23.jpg)
Database Systems, 9th Edition23
![Page 24: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/24.jpg)
Weak Entities
Database Systems, 9th Edition24
Weak entity meets two conditionsExistence-dependentPrimary key partially or totally derived from
parent entity in relationshipDatabase designer determines whether an
entity is weak based on business rules
![Page 25: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/25.jpg)
Database Systems, 9th Edition25
![Page 26: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/26.jpg)
Relationship Participation
Database Systems, 9th Edition26
Optional participationOne entity occurrence does not require
corresponding entity occurrence in particular relationship
Mandatory participationOne entity occurrence requires
corresponding entity occurrence in particular relationship
![Page 27: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/27.jpg)
Database Systems, 9th Edition27
![Page 28: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/28.jpg)
Database Systems, 9th Edition28
![Page 29: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/29.jpg)
Relationship Degree
Database Systems, 9th Edition29
Indicates number of entities or participants associated with a relationship
Unary relationshipAssociation is maintained within single entity
Binary relationship Two entities are associated
Ternary relationship Three entities are associated
![Page 30: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/30.jpg)
Database Systems, 9th Edition30
![Page 31: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/31.jpg)
Database Systems, 9th Edition31
![Page 32: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/32.jpg)
Developing an ER Diagram
Database Systems, 9th Edition32
Database design is an iterative processCreate detailed narrative of organization’s
description of operationsIdentify business rules based on description of
operationsIdentify main entities and relationships from
business rulesDevelop initial ERDIdentify attributes and primary keys that
adequately describe entitiesRevise and review ERD
![Page 33: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/33.jpg)
Database Systems, 9th Edition33
![Page 34: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/34.jpg)
Database Systems, 9th Edition34
![Page 35: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/35.jpg)
Database Systems, 9th Edition35
![Page 36: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/36.jpg)
Database Systems, 9th Edition36
![Page 37: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/37.jpg)
Database Systems, 9th Edition37
![Page 38: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/38.jpg)
Database Systems, 9th Edition38
![Page 39: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/39.jpg)
Database Systems, 9th Edition39
![Page 40: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/40.jpg)
Database Systems, 9th Edition40
![Page 41: Entity Relationship (ER) Modeling](https://reader036.fdocuments.us/reader036/viewer/2022062422/56813a03550346895da1ce18/html5/thumbnails/41.jpg)
Database Systems, 9th Edition41