THE ENTITY RELATIONSHIP MODEL
The E-R model was introduced by Peter Chen in 1976. Key elements of the E-R model
are entities, attributes, identifiers and relationships.
1. ENTITY TYPE: An object or concept that is identified by the enterprise as having
an independent existence. They represent a set of objects in the real world with the
same properties. Also entity types are named as entity classes.
Example: Physical existence: Staff, Property, Customer, Part, Supplier, Product,
Conceptual existence: Viewing, Inspection, Sale, Work experience, etc.
Weak Entity Type: An entity type that is existence-dependent on some
other entity type. A special weak entity type is ID-dependent entity, in
which the identifier of one entity includes the identifier of another entity.
Strong Entity Type: An entity type that is not existence-dependent on
some other entity type.
2. ENTITY: Definition 1: Entity is an object or concept that is uniquely identifiable.
Definition 2: An entity is something that can be identified in the user’s
work environment, something that users want to track.
Entities are also named as entity occurrence or entity instance.
Examples and diagrammatic FATHER MOTHER CHILD
representation of entity types:
ATTRIBUTE: A property of an entity or a relationship type. Also named as property.
Example: Date_of_Birth, Sex, Age are attributes for Child Entity.
Attribute Domain is a set of values that may be assigned to a single-valued
attribute. For example Zip_Code attribute’s domain is 5-digit number for an
address in Türkiye.
Simple attribute is an attribute composed of a single component with an
independent existence. Sex is an example of simple attribute.
Composite attribute is an attribute composed of multiple components, each
with an independent existence. Address is an example of composite attribute. It
can be divided in to Street, Area, City and Zip_Code, which are simple
attributes. Address can be decided to be a single attribute also. The decision
depends on the requirements of the model.
Single-valued attribute is an attribute that holds single value for a single entity.
Multi-valued attribute is an attribute that holds multiple values for a single
entity. Example: An entity has multiple values of Tel_No attribute.
Derived attribute is an attribute that represents a value that is derivable from the
value of a related attribute or a set of attributes, not necessarily in the same
entity. Example: Age attribute can be derived from Date_of_Birth attribute.
Examples and diagrammatic representation of Student entity and its attributes:
Key is a data item that allows us to uniquely identify individual occurrences of an
Candidate Key is an attribute or set of attributes that uniquely identifies
individual occurrences of an entity type.
Primary Key is the key that is selected from candidate keys.
Examples: National_Insurance_Number is unique for every member of stuff.
Generally, …_ID is primary key for that attribute.
Composite Key is a candidate key that that consists of two or more attributes.
1. RELATIONSHIP TYPE: A meaningful association among entity types.
2. RELATIONSHIP: An association of entities where the association includes one entity
from each participating entity type.
3. DEGREE OF A RELATIONSHIP: The number of participating entities in a
Binary Relationship SP-ORDER
Binary Relationship has a degree of two.
Example of MOTHER FATHER
Ternary Relationship PARENT
Ternary Relationship has a degree of three.
Cardinality ratio determines the number of possible relationships for each
participating entity. The rules defining cardinality are business rules.
Maximum cardinality shows the maximum number of entities that can be involved in
Minimum cardinality shows the minimum number of entities that can be involved in a
Types of Binary Relationships:
One-to-one (1:1): A single entity of one type EMPLOYE 1:1 AUTO
is related to a single entity of another type. E
One-to-many (1:N): A single entity of one type
is related to many entities of another type. DORMITORY 1:N STUDENT
Many-to-many (M:N): Many entities of one N:M
type is related to many entities of another type. STUDENT CLUB
5. RECURSIVE RELATIONSHIP: A relationship where 1:N
the same entity participates more than once in different roles. STUDENT
E-R DIAGRAMS ROOMS-WITH
Entity-Relationship (E-R) diagrams are used to show the relations between entities.
E-R diagrams show maximum cardinality but
they do not show minimum cardinality. But we DORMITORY 1:N STUDENT
can use hash mark for “must” and oval for “free”. E
Example of showing attributes in E-R diagrams
DORMITORY STUDENT StudentYear
DORMITORY 1:N STUDENT
DORMITORY Contains STUDENT Contains DORM-OCCUPANT Contains
DormName StudentNumber Rent
Number of Rooms StudentYear
Multi-value attributes can be represented by creating a new weak entity.
CUSTOMER 1:N CONTACTNAME
CUSTOMER Contains CONTACTNAME Contains
Example E-R Diagram!