Organization of this Chapter:
• Introduction
• Superclasses and Subclasses
• Specialization and Generalization
• Constraints on specialization/generalization
• Aggregation and Composition
• Sample example
February 21, 2025 1
Enhanced ER Model
• The Enhanced ER model, EER model, includes all the
modeling concepts of ER model along with some additional
concepts like super class and sub class, specialization,
generalization, aggregation, and composition.
• Super class and Sub class:
– Super class is an entity type that has a relationship with one
or more subtypes. On the other hand, Sub class is a group
of entities with unique attributes.
– Sub class inherits properties and attributes from its super
class. Sub class and Super class relationship leads the
concept of Inheritance.
– The relationship between sub class and super class is
denoted with d symbol, where d means disjointness.
February 21, 2025 2
contd..
February 21, 2025 3
Specialization and Generalization
• Specialization
– The process of designating sub groupings within
an entity set is called Specialization.
– An entity set may be specialized by more than one
distinguishing features.
– ER-design, specialization is depicted by an
Inverted Triangle component labeled “IS A” (is a).
– Specialization can be repeatedly used to refine a
ER design.
February 21, 2025 4
contd..
February 21, 2025 5
Generalization
• Generalization is the process of combining similar entities into a
more generalized entity.
• It allows for the abstraction of common properties and relationships
shared by multiple entities into a single higher-level entity. This
process moves from specific to general.
• Purpose: Simplifies the data model by grouping common features
into a generalized (parent) entity, avoiding redundancy.
• Hierarchy: Generalization forms a bottom-up hierarchy, where
several lower-level entities are abstracted into a higher-level
generalized entity.
February 21, 2025 6
EER Model (contd..)
• Generalization:
– Generalization is a simple inversion of specialization. It is
the process of extracting common properties from a set of
entity types and creating a generalized entity type from it.
– It is a bottom-up approach in which two or more entitiy
types can be generalized to a higher level entity type, if
they have some attributes in common.
– Specialization adopts top-down approach, while
Generalization adopts bottom-up approach.
– A crucial property of the higher-level and lower-level
entities created by specialization and generalization is
attribute inheritance.
– A lower-level entity set (or subclass) also inherits
participation in the relationship sets in which its higher-
level entity (or superclass) participates
February 21, 2025 7
contd..
February 21, 2025 8
• Construct an ER diagram for the following:
• “A university maintains record of students
and the programmes in which they have
enrolled. It stores the student name, id ,
phone no, address of student and
programme code ,programme name and
duration. A student is either full time or part
time student(only one of the types). A
student can register for multiple
prgrammmes and vice versa.”
February 21, 2025 9
Steps to draw ER diagram
• An Entity-Relationship (ER) diagram is used to
visually represent the structure of a database. It
shows entities, relationships, and the attributes
that describe them. Here’s a step-by-step guide
to draw an ER diagram:
• Identify Entities
• Entities are objects or concepts about which
data is stored. These could be things like
"Customer," "Order," or "Product."
• Entities are typically represented by rectangles.
February 21, 2025 10
• Identify Relationships
• A relationship is a connection between two or
more entities. For example, a "Customer" can
"Place" an "Order."
• Relationships are shown using diamonds or
lines connecting entities.
• Example:
• "Customer" places "Order" (relationship: places)
February 21, 2025 11
• Determine the Cardinality of Relationships
• Cardinality defines how entities relate to each other (e.g.,
one-to-one, one-to-many, many-to-many).
• Use notations like "1" or "M" to specify cardinality. For
example, one customer can place many orders (1 to M
relationship).
• Example:
• 1 Customer places M Orders
February 21, 2025 12
• Add Attributes
• Attributes provide more details about each entity (e.g.,
"Customer Name," "Order Date").
• Attributes are represented by ovals connected to their
respective entity rectangles.
• Example:
• Attributes of "Customer": CustomerID, CustomerName,
Email
• Attributes of "Order": OrderID, OrderDate, TotalAmount
February 21, 2025 13
• Identify Primary Keys
• Each entity should have a primary key, a unique identifier
for each record in that entity
• Define Foreign Keys (if any)
• Foreign keys establish links between related entities. For
example, "Order" might have a foreign key "CustomerID"
that links it back to the "Customer" entity.
• Example:
• The "Order" entity could have a "CustomerID" attribute,
which is a foreign key from the "Customer" entity.
February 21, 2025 14
• Normalize the Diagram (Optional)
• Review your diagram to ensure that there
is no redundancy or unnecessary
relationships.
• Normalize the design to avoid data
duplication.
February 21, 2025 15
Constraints in Generalization:
• Loss of Specificity: By generalizing, you may lose
some specific characteristics of individual entities in the
higher-level abstraction
• Design Complexity: While generalization reduces
redundancy, it may increase the complexity of
relationships and hierarchy in the database schema.
• .
February 21, 2025 16
Constraints on Generalization/Specialization
• Membership Constraint
– Condition defined/Attribute defined
• All the lower level entity is identified on the basis of same type of
attribute this type of generalization is said to be attribute defined.
– Here the lower level entity is generalized on the basis
of accnt type.
February 21, 2025 17
Accnt no Accnt name Branch Accnt type
005 a1 Ambala Saving a
008 a2 chandigarh Current a
009 a3 mohali Saving a
– User-defined
• User-defined lower-level entity sets are not constrained by a
membership condition; rather, the database user assigns entities to a
given entity set.
• EX: A celebrity can be personalised into actor and politician.
• Disjoint constraints
– Disjoint:
• The disjoint constraint only applies when a superclass has more
than one subclass. If the subclasses are disjoint, then an entity
occurrence can be a member of only one of the subclasses .e.g.
postgrads or undergrads; one cannot be both.
• To represent a disjoint superclass/subclass relationship, Or is used.
February 21, 2025 18
contd..
• Overlapping: This applies when an entity occurrence may be a
member of more than one subclass, e.g. student and staff; some
people are both. And is used to represent the overlapping
specialization/generalization relationship in the ER diagram.
February 21, 2025 19
contd..
• Completeness constraints
– Total: Each superclass (higher-level entity) must belong to
subclasses (lower-level entity sets), e.g. a student must be
postgrad or undergrad. To represent completeness in the
specialization/generalization relationship, the keyword
Mandatory is used.
February 21, 2025 20
contd..
• Partial: Some superclasses may not belong to subclasses
(lower-level entity sets), e.g. some people at UCT are neither
student nor staff. The keyword Optional is used to represent a
partial specialization/generalization relationship.
February 21, 2025 21
Aggregation and Composition
• Aggregation:
– Aggregation represents a has-a relationship between entity types,
where one represents the whole and the other the part.
– An example of aggregation is the Car and Engine entities. A car is
made up of an engine. The car is the whole and the engine is the part.
– Aggregation does not represent strong ownership. This means, a part
can exist on its own without the whole. There is no stronger ownership
between a car and the engine. An engine of a car can be moved to
another car.
– A line with a diamond at the end is used to represent aggregation.The
whole must be put at the end of the diamond.
February 21, 2025 22
contd..
• Composition
– Composition is a form of aggregation that represents an
association between entities, where there is a strong
ownership between the whole and the part.
– For example,: a tree and a branch have a composition
relationship. A branch is 'part' of a 'whole' tree - we cannot
cut the branch and add it to another tree.
– A line with a filled diamond at the end is used to represent
composition where the diamond side is towards the part
side.
February 21, 2025 23
An Example
February 21, 2025 24

extended modelling in dbms using different.pptx

  • 1.
    Organization of thisChapter: • Introduction • Superclasses and Subclasses • Specialization and Generalization • Constraints on specialization/generalization • Aggregation and Composition • Sample example February 21, 2025 1
  • 2.
    Enhanced ER Model •The Enhanced ER model, EER model, includes all the modeling concepts of ER model along with some additional concepts like super class and sub class, specialization, generalization, aggregation, and composition. • Super class and Sub class: – Super class is an entity type that has a relationship with one or more subtypes. On the other hand, Sub class is a group of entities with unique attributes. – Sub class inherits properties and attributes from its super class. Sub class and Super class relationship leads the concept of Inheritance. – The relationship between sub class and super class is denoted with d symbol, where d means disjointness. February 21, 2025 2
  • 3.
  • 4.
    Specialization and Generalization •Specialization – The process of designating sub groupings within an entity set is called Specialization. – An entity set may be specialized by more than one distinguishing features. – ER-design, specialization is depicted by an Inverted Triangle component labeled “IS A” (is a). – Specialization can be repeatedly used to refine a ER design. February 21, 2025 4
  • 5.
  • 6.
    Generalization • Generalization isthe process of combining similar entities into a more generalized entity. • It allows for the abstraction of common properties and relationships shared by multiple entities into a single higher-level entity. This process moves from specific to general. • Purpose: Simplifies the data model by grouping common features into a generalized (parent) entity, avoiding redundancy. • Hierarchy: Generalization forms a bottom-up hierarchy, where several lower-level entities are abstracted into a higher-level generalized entity. February 21, 2025 6
  • 7.
    EER Model (contd..) •Generalization: – Generalization is a simple inversion of specialization. It is the process of extracting common properties from a set of entity types and creating a generalized entity type from it. – It is a bottom-up approach in which two or more entitiy types can be generalized to a higher level entity type, if they have some attributes in common. – Specialization adopts top-down approach, while Generalization adopts bottom-up approach. – A crucial property of the higher-level and lower-level entities created by specialization and generalization is attribute inheritance. – A lower-level entity set (or subclass) also inherits participation in the relationship sets in which its higher- level entity (or superclass) participates February 21, 2025 7
  • 8.
  • 9.
    • Construct anER diagram for the following: • “A university maintains record of students and the programmes in which they have enrolled. It stores the student name, id , phone no, address of student and programme code ,programme name and duration. A student is either full time or part time student(only one of the types). A student can register for multiple prgrammmes and vice versa.” February 21, 2025 9
  • 10.
    Steps to drawER diagram • An Entity-Relationship (ER) diagram is used to visually represent the structure of a database. It shows entities, relationships, and the attributes that describe them. Here’s a step-by-step guide to draw an ER diagram: • Identify Entities • Entities are objects or concepts about which data is stored. These could be things like "Customer," "Order," or "Product." • Entities are typically represented by rectangles. February 21, 2025 10
  • 11.
    • Identify Relationships •A relationship is a connection between two or more entities. For example, a "Customer" can "Place" an "Order." • Relationships are shown using diamonds or lines connecting entities. • Example: • "Customer" places "Order" (relationship: places) February 21, 2025 11
  • 12.
    • Determine theCardinality of Relationships • Cardinality defines how entities relate to each other (e.g., one-to-one, one-to-many, many-to-many). • Use notations like "1" or "M" to specify cardinality. For example, one customer can place many orders (1 to M relationship). • Example: • 1 Customer places M Orders February 21, 2025 12
  • 13.
    • Add Attributes •Attributes provide more details about each entity (e.g., "Customer Name," "Order Date"). • Attributes are represented by ovals connected to their respective entity rectangles. • Example: • Attributes of "Customer": CustomerID, CustomerName, Email • Attributes of "Order": OrderID, OrderDate, TotalAmount February 21, 2025 13
  • 14.
    • Identify PrimaryKeys • Each entity should have a primary key, a unique identifier for each record in that entity • Define Foreign Keys (if any) • Foreign keys establish links between related entities. For example, "Order" might have a foreign key "CustomerID" that links it back to the "Customer" entity. • Example: • The "Order" entity could have a "CustomerID" attribute, which is a foreign key from the "Customer" entity. February 21, 2025 14
  • 15.
    • Normalize theDiagram (Optional) • Review your diagram to ensure that there is no redundancy or unnecessary relationships. • Normalize the design to avoid data duplication. February 21, 2025 15
  • 16.
    Constraints in Generalization: •Loss of Specificity: By generalizing, you may lose some specific characteristics of individual entities in the higher-level abstraction • Design Complexity: While generalization reduces redundancy, it may increase the complexity of relationships and hierarchy in the database schema. • . February 21, 2025 16
  • 17.
    Constraints on Generalization/Specialization •Membership Constraint – Condition defined/Attribute defined • All the lower level entity is identified on the basis of same type of attribute this type of generalization is said to be attribute defined. – Here the lower level entity is generalized on the basis of accnt type. February 21, 2025 17 Accnt no Accnt name Branch Accnt type 005 a1 Ambala Saving a 008 a2 chandigarh Current a 009 a3 mohali Saving a
  • 18.
    – User-defined • User-definedlower-level entity sets are not constrained by a membership condition; rather, the database user assigns entities to a given entity set. • EX: A celebrity can be personalised into actor and politician. • Disjoint constraints – Disjoint: • The disjoint constraint only applies when a superclass has more than one subclass. If the subclasses are disjoint, then an entity occurrence can be a member of only one of the subclasses .e.g. postgrads or undergrads; one cannot be both. • To represent a disjoint superclass/subclass relationship, Or is used. February 21, 2025 18
  • 19.
    contd.. • Overlapping: Thisapplies when an entity occurrence may be a member of more than one subclass, e.g. student and staff; some people are both. And is used to represent the overlapping specialization/generalization relationship in the ER diagram. February 21, 2025 19
  • 20.
    contd.. • Completeness constraints –Total: Each superclass (higher-level entity) must belong to subclasses (lower-level entity sets), e.g. a student must be postgrad or undergrad. To represent completeness in the specialization/generalization relationship, the keyword Mandatory is used. February 21, 2025 20
  • 21.
    contd.. • Partial: Somesuperclasses may not belong to subclasses (lower-level entity sets), e.g. some people at UCT are neither student nor staff. The keyword Optional is used to represent a partial specialization/generalization relationship. February 21, 2025 21
  • 22.
    Aggregation and Composition •Aggregation: – Aggregation represents a has-a relationship between entity types, where one represents the whole and the other the part. – An example of aggregation is the Car and Engine entities. A car is made up of an engine. The car is the whole and the engine is the part. – Aggregation does not represent strong ownership. This means, a part can exist on its own without the whole. There is no stronger ownership between a car and the engine. An engine of a car can be moved to another car. – A line with a diamond at the end is used to represent aggregation.The whole must be put at the end of the diamond. February 21, 2025 22
  • 23.
    contd.. • Composition – Compositionis a form of aggregation that represents an association between entities, where there is a strong ownership between the whole and the part. – For example,: a tree and a branch have a composition relationship. A branch is 'part' of a 'whole' tree - we cannot cut the branch and add it to another tree. – A line with a filled diamond at the end is used to represent composition where the diamond side is towards the part side. February 21, 2025 23
  • 24.