UNIT 1
Lecture 6
E R Model
Dinesh Kumar Bhawnani, BIT DURG
Relationship
• A relationship is an association among several entities.
• For example, we can define a relationship that associates customer
Hayes with loan L-15.
• This relationship specifies that Hayes is a customer with loan number
L-15.
Dinesh Kumar Bhawnani, BIT DURG
Hayes L-15
Relationship Set
• A relationship set is a set of relationships of the same type.
• Formally, it is a mathematical relation on n ≥ 2 (possibly non-distinct)
entity sets. If E1, E2, . . .,En are entity sets, then a relationship set R is
a subset of
{(e1, e2, . . . , en) | e1 ε E1, e2 ε E2, . . . , en ε En}
where (e1, e2, . . . , en) is a relationship.
• Consider the two entity sets customer and loan. We define the
relationship set borrower to denote the association between
customers and the bank loans that the customers have.
Dinesh Kumar Bhawnani, BIT DURG
Relationship Set (Borrower)
Dinesh Kumar Bhawnani, BIT DURG
Relationship Set (Borrower)
Dinesh Kumar Bhawnani, BIT DURG
Participation
• The association between entity sets is referred to as
participation; that is, the entity sets E1, E2, . . .,En
participate in relationship set R.
• The participation of an entity set E in a relationship
set R is said to be total if every entity in E participates
in at least one relationship in R.
• If only some entities in E participate in relationships in
R, the participation of entity set E in relationship R is
said to be partial.
Dinesh Kumar Bhawnani, BIT DURG
participation
Dinesh Kumar Bhawnani, BIT DURG
S1
S2
S3
S4
S5
S6
T1
T2
T3
T4
T5
STUDENT teaches TEACHER
participation
Dinesh Kumar Bhawnani, BIT DURG
STUDENT TEACHERteaches
partial total
Relationship Instance
• A relationship instance in an E-R schema represents an
association between the named entities in the real-world
enterprise that is being modeled.
• For. E.g., the individual customer entity Hayes, who has
customer identifier 677-89-9011, and the loan entity L-15
participate in a relationship instance of borrower.
• This relationship instance represents that, in the real-world
enterprise, the person called Hayes who holds customer-id
677-89-9011 has taken the loan that is numbered L-15.
Dinesh Kumar Bhawnani, BIT DURG
Descriptive Attribute
• A relationship may also have attributes called descriptive attributes.
• Consider a relationship set depositor with entity sets customer and
account. We could associate the attribute access-date to that
relationship to specify the most recent date on which a customer
accessed an account.
• The depositor relationship among the entities corresponding to
customer Jones and account A-217 has the value “23 May 2001” for
attribute access-date, which means that the most recent date that
Jones accessed account A-217 was 23 May 2001.
Dinesh Kumar Bhawnani, BIT DURG
Descriptive Attribute
Dinesh Kumar Bhawnani, BIT DURG
Degree
• The number of entity sets that participate in a
relationship set is called the degree of the relationship
set.
• A unary relationship set is of degree 1;
• A binary relationship set is of degree 2;
• A ternary relationship set is of degree 3.
Dinesh Kumar Bhawnani, BIT DURG
Unary Relationship (n = 1)
Dinesh Kumar Bhawnani, BIT DURG
Binary Relationship (n=2)
Dinesh Kumar Bhawnani, BIT DURG
Ternary Relationship (n=3)
Dinesh Kumar Bhawnani, BIT DURG
Role
• The function that an entity plays in a relationship is called that entity’s
role.
• Since entity sets participating in a relationship set are generally
distinct, roles are implicit and are not usually specified. However, they
are useful when the meaning of a relationship needs clarification.
Such is the case when the entity sets of a relationship set are not
distinct; that is, the same entity set participates in a relationship set
more than once, in different roles.
• In this type of relationship set, sometimes called a recursive
relationship set, explicit role names are necessary to specify how an
entity participates in a relationship instance.
Dinesh Kumar Bhawnani, BIT DURG
Unary Relationship (Recursive Relationship)
Dinesh Kumar Bhawnani, BIT DURG
Mapping Cardinalities (Cardinality Ratio)
• Mapping cardinalities, or cardinality ratios, express the number of
entities to which another entity can be associated via a relationship
set.
• Mapping cardinalities are most useful in describing binary
relationship sets, although they can contribute to the description of
relationship sets that involve more than two entity sets.
• For a binary relationship set R between entity sets A and B, the
mapping cardinality must be one of the following:
• One to one (1:1)
• One to many (1:M)
• Many to one (M:1)
• Many to many (M:N)
Dinesh Kumar Bhawnani, BIT DURG
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.
Dinesh Kumar Bhawnani, BIT DURG
A BR
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.
Dinesh Kumar Bhawnani, BIT DURG
A BR
Many to one
• An entity in A is associated with at most one entity in B. An entity in B, however,
can be associated with any number (zero or more) of entities in A.
Dinesh Kumar Bhawnani, BIT DURG
A BR
Many to many
• An entity in A is associated with any number (zero or more) of entities in B, and
an entity in B is associated with any number (zero or more) of entities in A.
Dinesh Kumar Bhawnani, BIT DURG
A BR
University Questions
1. Write short notes on
a) Participation Constraints
b) Mapping Cardinality (Cardinality Ratio)
2. What is the degree of relationship? Explain recursive
relationship with example.
Dinesh Kumar Bhawnani, BIT DURG
For Video lecture on this topic please subscribe to my youtube channel.
The link for my youtube channel is
https://www.youtube.com/channel/UCRWGtE76JlTp1iim6aOTRuw?sub
_confirmation=1
Dinesh Kumar Bhawnani, BIT DURG

Dbms Notes Lecture 6 : E R Model, Relationship, Cardinality Ratio

  • 1.
    UNIT 1 Lecture 6 ER Model Dinesh Kumar Bhawnani, BIT DURG
  • 2.
    Relationship • A relationshipis an association among several entities. • For example, we can define a relationship that associates customer Hayes with loan L-15. • This relationship specifies that Hayes is a customer with loan number L-15. Dinesh Kumar Bhawnani, BIT DURG Hayes L-15
  • 3.
    Relationship Set • Arelationship set is a set of relationships of the same type. • Formally, it is a mathematical relation on n ≥ 2 (possibly non-distinct) entity sets. If E1, E2, . . .,En are entity sets, then a relationship set R is a subset of {(e1, e2, . . . , en) | e1 ε E1, e2 ε E2, . . . , en ε En} where (e1, e2, . . . , en) is a relationship. • Consider the two entity sets customer and loan. We define the relationship set borrower to denote the association between customers and the bank loans that the customers have. Dinesh Kumar Bhawnani, BIT DURG
  • 4.
    Relationship Set (Borrower) DineshKumar Bhawnani, BIT DURG
  • 5.
    Relationship Set (Borrower) DineshKumar Bhawnani, BIT DURG
  • 6.
    Participation • The associationbetween entity sets is referred to as participation; that is, the entity sets E1, E2, . . .,En participate in relationship set R. • The participation of an entity set E in a relationship set R is said to be total if every entity in E participates in at least one relationship in R. • If only some entities in E participate in relationships in R, the participation of entity set E in relationship R is said to be partial. Dinesh Kumar Bhawnani, BIT DURG
  • 7.
    participation Dinesh Kumar Bhawnani,BIT DURG S1 S2 S3 S4 S5 S6 T1 T2 T3 T4 T5 STUDENT teaches TEACHER
  • 8.
    participation Dinesh Kumar Bhawnani,BIT DURG STUDENT TEACHERteaches partial total
  • 9.
    Relationship Instance • Arelationship instance in an E-R schema represents an association between the named entities in the real-world enterprise that is being modeled. • For. E.g., the individual customer entity Hayes, who has customer identifier 677-89-9011, and the loan entity L-15 participate in a relationship instance of borrower. • This relationship instance represents that, in the real-world enterprise, the person called Hayes who holds customer-id 677-89-9011 has taken the loan that is numbered L-15. Dinesh Kumar Bhawnani, BIT DURG
  • 10.
    Descriptive Attribute • Arelationship may also have attributes called descriptive attributes. • Consider a relationship set depositor with entity sets customer and account. We could associate the attribute access-date to that relationship to specify the most recent date on which a customer accessed an account. • The depositor relationship among the entities corresponding to customer Jones and account A-217 has the value “23 May 2001” for attribute access-date, which means that the most recent date that Jones accessed account A-217 was 23 May 2001. Dinesh Kumar Bhawnani, BIT DURG
  • 11.
  • 12.
    Degree • The numberof entity sets that participate in a relationship set is called the degree of the relationship set. • A unary relationship set is of degree 1; • A binary relationship set is of degree 2; • A ternary relationship set is of degree 3. Dinesh Kumar Bhawnani, BIT DURG
  • 13.
    Unary Relationship (n= 1) Dinesh Kumar Bhawnani, BIT DURG
  • 14.
    Binary Relationship (n=2) DineshKumar Bhawnani, BIT DURG
  • 15.
    Ternary Relationship (n=3) DineshKumar Bhawnani, BIT DURG
  • 16.
    Role • The functionthat an entity plays in a relationship is called that entity’s role. • Since entity sets participating in a relationship set are generally distinct, roles are implicit and are not usually specified. However, they are useful when the meaning of a relationship needs clarification. Such is the case when the entity sets of a relationship set are not distinct; that is, the same entity set participates in a relationship set more than once, in different roles. • In this type of relationship set, sometimes called a recursive relationship set, explicit role names are necessary to specify how an entity participates in a relationship instance. Dinesh Kumar Bhawnani, BIT DURG
  • 17.
    Unary Relationship (RecursiveRelationship) Dinesh Kumar Bhawnani, BIT DURG
  • 18.
    Mapping Cardinalities (CardinalityRatio) • Mapping cardinalities, or cardinality ratios, express the number of entities to which another entity can be associated via a relationship set. • Mapping cardinalities are most useful in describing binary relationship sets, although they can contribute to the description of relationship sets that involve more than two entity sets. • For a binary relationship set R between entity sets A and B, the mapping cardinality must be one of the following: • One to one (1:1) • One to many (1:M) • Many to one (M:1) • Many to many (M:N) Dinesh Kumar Bhawnani, BIT DURG
  • 19.
    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. Dinesh Kumar Bhawnani, BIT DURG A BR
  • 20.
    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. Dinesh Kumar Bhawnani, BIT DURG A BR
  • 21.
    Many to one •An entity in A is associated with at most one entity in B. An entity in B, however, can be associated with any number (zero or more) of entities in A. Dinesh Kumar Bhawnani, BIT DURG A BR
  • 22.
    Many to many •An entity in A is associated with any number (zero or more) of entities in B, and an entity in B is associated with any number (zero or more) of entities in A. Dinesh Kumar Bhawnani, BIT DURG A BR
  • 23.
    University Questions 1. Writeshort notes on a) Participation Constraints b) Mapping Cardinality (Cardinality Ratio) 2. What is the degree of relationship? Explain recursive relationship with example. Dinesh Kumar Bhawnani, BIT DURG
  • 24.
    For Video lectureon this topic please subscribe to my youtube channel. The link for my youtube channel is https://www.youtube.com/channel/UCRWGtE76JlTp1iim6aOTRuw?sub _confirmation=1 Dinesh Kumar Bhawnani, BIT DURG