The Entity-Relationship (ER) Model
2.1 Background
· Used for conceptual database design
· Relies on concepts of entities, attributes, and relationships
· Benefits from pictorial representation, called ER diagrams
2.2 An Entity-Relationship (ER) Diagram
2.3 Entity Types
· Entity types represent sets of objects and are pictured by rectangular nodes
.
An entity set is the collection of instances (i.e., entities) represented by an entity type.
An entity set is also called an extension of the entity type
2.4 Relationship Types
· Relationship types associate entity types. They are pictured by Diamond nodes, and edges connecting to the related entity types.
A relationship set is the collection of instances (i.e., relationships between objects) represented by a relationship type.
Relationship types may associate an entity type with itself. In such a case, the roles of the entity types in the relationship type are listed on the edges, and the relationship is said to be recursive.
2.5 Attributes
· Entity types and relationship types might have attributes.
· The value set, or domain, of an attribute is the set of values that may be assigned to the attribute. Mathematically,
attribute : entity power-set(domain)
· Atomic attribute types, pictured by oval nodes
· Composite attribute types, achieved by concatenating simpler attribute types, pictured by trees of atomic attributes
· Multivalued attribute types
A ‘blue and red’ shirt
· Derived attribute types displayed in dashed ovals
A ‘age’ from ‘birth date’
2.6 Keys and Weak Entity Types
· Key attribute types, identify the instances, may be consisted of more than one attribute, displayed with underlined attribute type names
· Weak entity types have no keys. Displayed by double-rectangular nodes
· To be identified, instances of weak entity type require an identifying relationship type that relates them to an identifying entity type. Such relations are displayed by double-diamond nodes
· Weak entity types typically have partial key for distinguishing their instances.
Regular entity types with keys are sometimes called strong entity types.
2.7 Structural Relationship Constraints
Cardinality ratio constraint
· Specifies the number of relationship instances an entity can participate in
· Displayed on the diamonds
Participation constraint
· specifies whether the existence of an entity depends on its being related to another entity via the relationship type
· Total participation constraints require the participation of every entity the relationship (displayed by double line). Also called existence dependency.
· Partial participation constraints (displayed by a single line).
Cardinality constraint
Specifies lower and upper bounds on the number of relationships each entity can participate in.
Summary of Notation
Entity /Weak Entity /
Relationship /
Identifying Relationship /
Attribute /
Key Attribute /
Multivalued Attribute /
Composite Attribute /
Derived Attribute /
Total participation of E2 in R /
Cardinality ratio 1 : N for E1 : E2 in R /
Structural constraint (min,max) on participation of E in R /