The document describes the key concepts of an Entity-Relationship (ER) model, which is a high-level conceptual data model representing logical relationships between entities (or objects) to develop an initial database design. The ER model was first proposed by Peter Chen in the 1970s and uses ER diagrams to represent entities with properties and relationships. Entities have attributes and exist in entity sets. Relationships exist between entity sets and have cardinality constraints. Weak entities depend on strong/identifying entities. The ER model includes other concepts like keys, participation constraints, degree of relationships, and extended features like generalization/specialization and aggregation.
2. ER Model
• The entity-relationship model (or ER model) is a high-level conceptual
data model representing the logical relationships of entities (or
objects) in order to create a database and is widely used to develop
an initial database design.
• ER model was first proposed by Peter Pin-Shan Chen of
Massachusetts Institute of Technology (MIT) in the 1970s.
• The diagrammatic notation used in the ER model for representing
entities with properties and their relationships is known as ER
diagrams.
2
3. Entity and Entity Sets
• Entities
• An entity is a “thing” or “object” in the real world that is
distinguishable from all other objects.
For example, each person in an enterprise is an entity.
• Entity Sets
• An entity set is a set of entities of the same type that share the
same properties, or attributes.
• Set of all persons who are customers at a given bank can
be defined as the entity set customer.
• Other examples: students, courses, employees, departments,
flights, patients.
3
5. Attributes
• Attributes are descriptive properties possessed by each
member of an entity set.
• Possible attributes of the customer entity set are customer-id,
customer-name, customer-street, and customer-city.
• Other examples: course name, deptname, departure time, age,
room
• For each attribute, there is a set of permitted values, called the
domain, or value set, of that attribute.
5
6. Attributes
• Single-valued vs Multi-valued:
• Single valued attributes have a single value for a particular entity
while Multi-valued attributes have a set of values for a specific entity.
• Eg. color of car could be multi-valued
• salary of employee is single-valued
• Atomic vs Composite:
• Atomic attributes are not divided into subparts while Composite
attributes can be divided into subparts (other attributes).
• Eg. age of a person is atomic
• address of a person could be composite
• Stored vs Derived:
• Derived attributes are those that can be derived from other attributes
or entities, e.g., age can be derived from date of birth.
• All other attributes are stored attributes
6
8. Relationships
• Relationship:
• An association between multiple entities
• Relationship Set:
• A collection of relationships all belonging to one relationship
type.
• A relationship may also have attributes called descriptive
attributes.
• It may be Unary, Binary, Ternary, 4-nary relationship sets
8
10. Weak Entity Sets
• Entity sets that do not have sufficient attributes to form a key
are called weak entity sets.
• For a weak entity set to be meaningful, it must be associated
with another entity set, called the identifying or owner entity
set.
• So, a weak entity set existentially depend upon (one or more)
strong owner entity sets from whom they derive their key.
• A weak entity set may have a discriminator (or a partial key)
that distinguish between weak entities related to the same
strong entity
• key of weak entity set = Key of owner entity set(s) +
discriminator
10
11. Weak Entity Sets(Contd.)
Example:
Consider the entity set payment, which has the three attributes:
payment-number, payment-date, and payment-amount.
• Payment numbers are typically sequential numbers, starting
from 1, generated separately for each loan.
• Although each payment entity is distinct, payments for different
loans may share the same payment number.
• Thus, this entity set does not have a primary key; it is a weak
entity set.
11
13. Example: Weak Entity Set Notations
• Double rectangles for weak entity set
• Double diamond for weak entity relationship
• Dashed underscore for discriminator
13
14. Structural Constraints
• Two main types of restrictions on relationships are:
• Cardinality Constraints
• Participation Constraints
• Cardinality Constraints is the number of instances of one
entity that can or must be associated with each instance
of another entity
14
15. Cardinality Constraints on Relationship
Sets
• Consider binary relationship set R
between entity sets A and B
• One to one: an entity in A is associated
with at most one entity in B, and an entity
in B is associated with at most one entity
in A.
• an employee has only one spouse in a married-
to relationship.
15
16. Cardinality Constraints on Relationship
Sets(Contd.)
• One to many. An entity in A is associated
with any number (zero or more) of
• entities in B. An entity in B, however, can
be associated with at most one entity
in A.
• A customer can order different items online.
16
17. Cardinality Constraints on Relationship
Sets(Contd.)
• Many to One: An entity in A is
associated with at most one entity in B,
an entity in B is associated with many
entities in A.
• an employee works in a single department
but a department consists of many
employees.
17
18. Cardinality Constraints on Relationship
Sets(Contd.)
• Many to Many: An entity in A is associated
with many entities in B, and an entity in B
is associated with many entities in A.
• A customer may have many bank accounts.
Accounts may be joint between multiple
customers.
18
22. Participation Constraints
• Total Participation:
• The participation of an entity set in a relationship set is said to be
total if every entity from the entity set participates in at least one
relationship of the relationship set.
• Partial Participation:
• If only some entities from entity sets participates in relationships of
relationship set, then the participation is called partial.
22
23. Total participation
• When we require all entities to participate in the
relationship (total participation), we use double lines to
specify
• A double line from loan to borrower indicates that each
loan must have at least one associated customer.
23
24. Keys
• A key allows to identify a set of attributes that suffice to
distinguish entities from each other.
• A super key of an entity set is a set of one or more attributes that,
taken collectively, allow to identify uniquely an entity in the entity
set.
• A candidate key of an entity set is a minimal super key.
i.e. it uniquely identifies any database record without referring to any other
data.
• Although several candidate keys may exist, one of the candidate
keys is selected to be the primary key.
24
25. Key Examples
• Suggest super keys for the following entity?
• What are the candidate keys?
• Primary key?
25
26. Degree of Relationship
• Degree of a relationship is the number of entity types that
participate in it
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
26
27. Unary relationship(Role indicator)
• The labels “manger” and “worker” are called roles the self relationship
• More Examples?
• People to people
• Parent – children
• Manager – employee
• Husband – wife
• Word to word
• Root – synonym
27
28. Role indicator
• The function that an entity plays in a relationship is called
its role
• Roles are normally not explicitly specified unless the
meaning of the relationship needs clarification
• Roles needed when entity set is related to itself via a
relationship.
28
32. Generalization and Specialization
• A lower-level entity set inherits all the attributes and
relationship participation of the higher-level entity set to which it
is linked.
• A lower-level entity set may have additional attributes and
participate in additional relationships.
• Generalization is a bottom-up approach in which two or more
lower level entities combine to form a higher level entity.
• In generalization, the higher level entity can also combine with
other lower level entity to make further higher level entity.
• Specialization is a top-down approach in which one higher
level entity can be broken down into two or more lower level
entity.
32
34. Aggregation
• One limitation of the E-R model is that it cannot express relationships among
relationships.
• consider the ternary relationship “works-on” between a employee, branch,
and job.
• suppose we want to record managers for tasks performed by an employee at
a branch.
• One alternative for representing this
relationship is to create a quaternary
relationship manages between
employee, branch, job, and manager.
• There is redundant information in the
resultant figure.
34
35. Aggregation
• Aggregation is an abstraction through which relationships are
treated as higher level entities.
• Aggregation is a process when relation between two entity is
treated as a single entity.
35
Editor's Notes
Example: Employee assigned to project. Student gets scholarship. Students apply for scholarship.
A person is married to a person, employee supervises employee.