Chapter 12
Entity Relationship
Modeling
Characteristics of E-R Modeling
– Proposed by Dr. Peter Chen in 1976
– Semantic data model
– Express the logical properties of an enterprise
database
– No physical DBMS
– Unified Modeling Language (UML)
Components of E-R Model
– Entity
– Attribute
– Keys
– Relationship
– Constraints
Entity
–An entity is an object that exists and which
is distinguishable from other objects. An
entity can be a person, a place, an object,
an event, or a concept about which an
organization wishes to maintain data
Entity
– Different Types of Entities
o Strong entity (parent, owner, dominant)
o Weak entity (child, dependent, or subordinate)
o Associative entity
– Diagram Notation
–
Entity
– An Associative Entity is an entity type that
connects the instances of one or more entity
types and contains attributes particular to this
association.
– A Strong Entity type exists independent of
other entity types, while a Weak Entity type
depends on another entity type.
Attribute
– Domain
– Types of Attribute
o Simple Attribute
o Composite Attribute
o Single-valued Attribute
o Multi-valued Attribute
o Derived Attribute
Keys
–Candidate key
–Primary key
–Composite key
Relationship
– Relationships are Meaningful Associations between
or among entities.
– Weak relationships, or identifying relationships, are
connections that exist between a weak entity type
and its owner.
Relationship
– Degree of a relationship
o The number (unary, binary, or ternary) of entity
sets that participate in a relationship is called the
degree of relationship.
– Types of Relationship
o Unary (recursive relationship)
o Binary
o Ternary
o Quaternary
Relationship
Relationship
Structural Constraints on
Relationship
– The main type of constraint on relationships is called
Multiplicity.
– The number of possible occurrences of an entity
type that may relate to a single occurrence of an
associated entity type through a particular
relationship.
– One-to-one 1..1
– One-to-many 1..*
One to One Relationship
One to Many Relationship
Many to Many Relationship
Multiplicity Constraints
– Multiplicity actually consists of two separate
constraints known as cardinality and
participation.
– The Cardinality of relationship represents the
minimum/maximum number of instances of
entity B that must/can be associated with any
instance of entity A.
Cardinality Constraint
Example
Multiplicity Constraints
Multiplicity Constraints
– Participation constraints
– Determines whether all or only some entity
occurrences participate in a relationship.
– Total (mandatory, every one involved)
– Partial (optional, only some involved)
–
Problems with ER Models
– Improper relationship (Connection Trap)
– Fan trap (ambiguous pathway)
– Chasm trap (missing pathway)
Example
A university consists of a number of departments.
Each department offers several courses. A number
of modules make up each course. Students enrol in
a particular course and take modules towards the
completion of that course. Each module is taught by
a lecturer from the appropriate department, and
each lecturer tutors a group of students
Example - Entities
A university consists of a number of departments.
Each department offers several courses. A number of
modules make up each course. Students enrol in a
particular course and take modules towards the
completion of that course. Each module is taught by
a lecturer from the appropriate department, and
each lecturer tutors a group of students
Example - E/R Diagram
ModuleCourse
Department
Student
Lecturer
Entities: Department, Course, Module, Lecturer, Student
Example - E/R Diagram
ModuleCourse
Department
Student
Lecturer
Offers Each department offers
several courses
Example - E/R Diagram
ModuleCourse
Department
Student
LecturerIncludes
Offers
A number of modules make up each courses
Example - E/R Diagram
ModuleCourse
Department
Student
LecturerIncludes
Offers
Enrols In
Students enrol in a particular course
Example - E/R Diagram
ModuleCourse
Department
Student
LecturerIncludes
Offers
Enrols In
Takes
Students … take modules
Example - E/R Diagram
ModuleCourse
Department
Student
LecturerIncludes
Offers
Enrols In
Takes
Teaches
Each module is taught by
a lecturer
Example - E/R Diagram
ModuleCourse
Department
Student
LecturerIncludes
Offers
Enrols In
Takes
Employs
Teaches
A lecturer from the
appropriate department
Example - E/R Diagram
ModuleCourse
Department
Student
LecturerIncludes
Offers
TutorsEnrols In
Takes
Employs
Teaches
each lecturer tutors a group of students
Example - E/R Diagram
ModuleCourse
Department
Student
LecturerIncludes
Offers
TutorsEnrols In
Takes
Employs
Teaches

Chapter # 12 er modeling

  • 1.
  • 2.
    Characteristics of E-RModeling – Proposed by Dr. Peter Chen in 1976 – Semantic data model – Express the logical properties of an enterprise database – No physical DBMS – Unified Modeling Language (UML)
  • 3.
    Components of E-RModel – Entity – Attribute – Keys – Relationship – Constraints
  • 4.
    Entity –An entity isan object that exists and which is distinguishable from other objects. An entity can be a person, a place, an object, an event, or a concept about which an organization wishes to maintain data
  • 5.
    Entity – Different Typesof Entities o Strong entity (parent, owner, dominant) o Weak entity (child, dependent, or subordinate) o Associative entity – Diagram Notation –
  • 6.
    Entity – An AssociativeEntity is an entity type that connects the instances of one or more entity types and contains attributes particular to this association. – A Strong Entity type exists independent of other entity types, while a Weak Entity type depends on another entity type.
  • 7.
    Attribute – Domain – Typesof Attribute o Simple Attribute o Composite Attribute o Single-valued Attribute o Multi-valued Attribute o Derived Attribute
  • 8.
  • 9.
    Relationship – Relationships areMeaningful Associations between or among entities. – Weak relationships, or identifying relationships, are connections that exist between a weak entity type and its owner.
  • 10.
    Relationship – Degree ofa relationship o The number (unary, binary, or ternary) of entity sets that participate in a relationship is called the degree of relationship. – Types of Relationship o Unary (recursive relationship) o Binary o Ternary o Quaternary
  • 11.
  • 12.
  • 13.
    Structural Constraints on Relationship –The main type of constraint on relationships is called Multiplicity. – The number of possible occurrences of an entity type that may relate to a single occurrence of an associated entity type through a particular relationship. – One-to-one 1..1 – One-to-many 1..*
  • 14.
    One to OneRelationship
  • 15.
    One to ManyRelationship
  • 16.
    Many to ManyRelationship
  • 17.
    Multiplicity Constraints – Multiplicityactually consists of two separate constraints known as cardinality and participation. – The Cardinality of relationship represents the minimum/maximum number of instances of entity B that must/can be associated with any instance of entity A.
  • 18.
  • 19.
  • 20.
  • 21.
    Multiplicity Constraints – Participationconstraints – Determines whether all or only some entity occurrences participate in a relationship. – Total (mandatory, every one involved) – Partial (optional, only some involved) –
  • 23.
    Problems with ERModels – Improper relationship (Connection Trap) – Fan trap (ambiguous pathway) – Chasm trap (missing pathway)
  • 24.
    Example A university consistsof a number of departments. Each department offers several courses. A number of modules make up each course. Students enrol in a particular course and take modules towards the completion of that course. Each module is taught by a lecturer from the appropriate department, and each lecturer tutors a group of students
  • 25.
    Example - Entities Auniversity consists of a number of departments. Each department offers several courses. A number of modules make up each course. Students enrol in a particular course and take modules towards the completion of that course. Each module is taught by a lecturer from the appropriate department, and each lecturer tutors a group of students
  • 26.
    Example - E/RDiagram ModuleCourse Department Student Lecturer Entities: Department, Course, Module, Lecturer, Student
  • 27.
    Example - E/RDiagram ModuleCourse Department Student Lecturer Offers Each department offers several courses
  • 28.
    Example - E/RDiagram ModuleCourse Department Student LecturerIncludes Offers A number of modules make up each courses
  • 29.
    Example - E/RDiagram ModuleCourse Department Student LecturerIncludes Offers Enrols In Students enrol in a particular course
  • 30.
    Example - E/RDiagram ModuleCourse Department Student LecturerIncludes Offers Enrols In Takes Students … take modules
  • 31.
    Example - E/RDiagram ModuleCourse Department Student LecturerIncludes Offers Enrols In Takes Teaches Each module is taught by a lecturer
  • 32.
    Example - E/RDiagram ModuleCourse Department Student LecturerIncludes Offers Enrols In Takes Employs Teaches A lecturer from the appropriate department
  • 33.
    Example - E/RDiagram ModuleCourse Department Student LecturerIncludes Offers TutorsEnrols In Takes Employs Teaches each lecturer tutors a group of students
  • 34.
    Example - E/RDiagram ModuleCourse Department Student LecturerIncludes Offers TutorsEnrols In Takes Employs Teaches