0% found this document useful (0 votes)
21 views

Lecture 6

Uploaded by

ishanvi039
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Lecture 6

Uploaded by

ishanvi039
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 50

Entity

Relationship
Model
Part-2
Weak Entity Set
• Weak entity set: An entity set that does not have a
primary key.
• Its existence depends on the existence of a strong
entity set.
• The discriminator of a weak entity set is the set of
attributes that distinguishes between all the entities of
a weak entity set.
• Its primary key is created by combining the primary
key of the strong entity set on which the weak entity
set is existence dependent and the weak entity set’s
discriminator.
• We underline the discriminator attribute with a dashed
line.
Example
Employee={eid,name, age,department}
Dependent={name,age,relation}

Identifyin
Employee Depende
g
nt
relationsh
ip
Weak Entity set examples contd.
Weak Entity set examples
Weak Entity set examples contd.
MCQ

• Weak entities and their identifying relationship in the ER


diagrams are represented by
• Oval shape with double line
• Rectangle shape with double line
• Square shape with double line
• Diamond shape with double line
MCQ

• Weak entities and their identifying relationship in the ER


diagrams are represented by
• Oval shape with double line
• Rectangle shape with double line
• Square shape with double line
• Diamond shape with double line
MCQ

• The entities that have key attributes to be distinct are


considered as
• Weak entity
• Strong entity
• Single entity
• Foreign entity
MCQ

• The entities that have key attributes to be distinct are


considered as
• Weak entity
• Strong entity
• Single entity
• Foreign entity
MCQ

• The parent entity type or identifying entity type are


considered as other names of
• Dominant entity type
• Non dominant entity type
• Composite entity type
• Non foreign entity type
MCQ

• The parent entity type or identifying entity type are


considered as other names of
• Dominant entity type
• Non dominant entity type
• Composite entity type
• Non foreign entity type
MCQ

• The set of key attributes that identify weak entities related


to owner entity is classified as
• Structural key
• Partial key
• String key
• Foreign key
MCQ

• The set of key attributes that identify weak entities related


to owner entity is classified as
• Structural key
• Partial key
• String key
• Foreign key
Steps in Designing an Entity-Relationship Schema

1. Identify entity types (entity type vs. attribute)


2. Identify relationship types
3. Identify and associate attributes with entity and relationship types
4. Determine attribute domains.
5. Determine primary key attributes for entity types
6. Associate (refined) cardinality ratio(s) with relationship types
7. Design generalization/specialization hierarchies including
constraints (includes natural language statements as well)
EER Model
• EER stands for Extended/Enhance ER model
• Enhanced entity-relationship diagrams are advanced database
diagrams very similar to regular ER diagrams which represents
requirements and complexities of complex databases.
• Why to go for EER model?
• The additional EER concepts are used to model applications more
accurately and more completely.
• EER includes some object oriented concepts such as inheritance.
Extended Features of ER Model
• Specialization
• Generalization
• Inheritance
Subclasses and Superclasses (1)
• An entity type may have additional meaningful subgroupings of its entities
• Example: EMPLOYEE may be further grouped into:
• SECRETARY, ENGINEER, TECHNICIAN, …
• Based on the EMPLOYEE’s Job
• MANAGER
• EMPLOYEEs who are managers
• SALARIED_EMPLOYEE, HOURLY_EMPLOYEE
• Based on the EMPLOYEE’s method of pay
• EER diagrams extend ER diagrams to represent these additional
subgroupings, called subclasses or subtypes
How Can you categorize employees of
BU
• Professors, Data Entry operators, clerks,
gardeners, drivers (job type)
• Deans( only deans manages schools)
• Permanent and contract employees (job
agreement)
Subclasses and Superclasses (2)
• These are also called IS-A relationships
• SECRETARY IS-A EMPLOYEE, TECHNICIAN IS-A EMPLOYEE, ….
• Note: An entity that is member of a subclass represents the
same real-world entity as some member of the superclass:
• The subclass member is the same entity in a distinct specific role
• An entity cannot exist in the database merely by being a member of
a subclass; it must also be a member of the superclass
Subclasses and Superclasses (2)
• A member of the superclass can be optionally included as a member of any number of
its subclasses
• Examples:
• A salaried employee who is also an engineer belongs to the two subclasses:
• ENGINEER, and
• SALARIED_EMPLOYEE
• A salaried employee who is also an engineering manager belongs to the three subclasses:
• MANAGER,
• ENGINEER, and
• SALARIED_EMPLOYEE
• It is not necessary that every entity in a superclass be a member of some subclass
Specialization
• Top-down design process: We designate sub grouping
within an entity set that are distinctive from other entities
in the set.
• The subgrouping become lower level entity sets that have
attributes or participate in relationships that do not apply
to the higher level entity set
• Depicted by a triangle component labelled ISA.
• Attribute inheritance: A lower level entity set inherits
all the attributes and relationship participation of the
linked higher entity set.
Specialization
Example
The distinguished
feature for
specialization are:
• The job the
employee performs.
• the person is a
temporary (limited-
term) employee or a
permanent
employee
Specialization
Lattice
• A specialization hierarchy has
the constraint that every
subclass participates as a
subclass in only
one class/subclass relationship
• For a specialization lattice, a
subclass can be a subclass
in more than
one class/subclass relationship.

A specialization lattice with


shared subclass
ENGINEERING_MANAGER
A Specialization
Lattice with
multiple
Inheritance for a
university
database
Generalization
• A bottom up design process:
Combine a number of entity sets
that share the same features into
a higher level entity set.
• The term generalization and
specialization are used
interchangeably.
• The ISA relationship can also
referred as “superclass-subclass”
relationship.
Inheritance
• Attributes of higher-level entity-sets are inherited by lower-
level entity-sets
• Relationships involving at higher level is also inherited by
lower level elements
• When entity-sets inherit from one super class
• Entity sets form a hierarchy
• When entity-sets inherit from multiple super classes
• Entity-sets form a lattice
Constraints on Specialization/Generalization:
Membership Constraints
• Predicate defined subclasses: The subclass is defined
through a predicate on the attributes of the superclass
• Attribute defined subclasses
• The subclasses in the specialization are all defined by the same
attribute of the superclass. E.g.- Based on account type, it can be
divided into saving and checking account.
• User defined subclasses
• Membership in the subclasses is determined at the insertion operation
level. E.g.- Team formed to create specific task
Constraints on Specialization/Generalization:
Disjointness Constraints
• Disjoint (d)
• The subclasses must have disjoint sets of entities
• Overlap (o)
• The subclasses may have overlapping sets of entities
Disjoint Example Overlapping Example
Constraints on Specialization/Generalization:
Completeness Constraints
• Partial
• An entity may not belong to any of the subclasses (single-line)
• Total
• Every entity in the superclass must be a member of some subclass
(double-edge)
Constraints on
Specialization/Generalization:
• Hence we have four types of Specialization/Generalization:
• Disjoint, total
• Disjoint partial
• Overlapping , total
• Overlapping, partial
• Note: Generalization usually is total because the
superclass is derived from the subclass.
mobilenum
Student
ber

Part-time Full-time
prepaid Post paid
student student
artist player

singer actor batsman bowler


Batch_2019_c
se

eb01 eb14
Aggregation
• An ER diagram is not capable of representing relationship
between an entity and a relationship which may be
required in some scenarios.
• In those cases, a relationship with its corresponding
entities is aggregated into a higher level entity.
• Aggregation is an abstraction through which relationships
are treated as higher level entities.
• It is used to express relationships among relationships.
Aggregation Contd.

Without Aggregation With Aggregation


MCQ

• The entity set person is classified as student and


employee. This process is called _________
a) Generalization
b) Specialization
c) Inheritance
d) Constraint generalization
MCQ

• The entity set person is classified as student and


employee. This process is called _________
a) Generalization
b) Specialization
c) Inheritance
d) Constraint generalization
MCQ

• Which relationship is used to represent a specialization


entity?
a) ISA
b) AIS
c) ONIS
d) WHOIS
MCQ

• Which relationship is used to represent a specialization


entity?
a) ISA
b) AIS
c) ONIS
d) WHOIS
MCQ

• There are similarities between the instructor entity set


and the secretary entity set in the sense that they have
several attributes that are conceptually the same across
the two entity sets: namely, the identifier, name, and
salary attributes. This process is called
a) Commonality
b) Specialization
c) Generalization
d) Similarity
MCQ

• There are similarities between the instructor entity set


and the secretary entity set in the sense that they have
several attributes that are conceptually the same across
the two entity sets: namely, the identifier, name, and
salary attributes. This process is called
a) Commonality
b) Specialization
c) Generalization
d) Similarity
MCQ

• The completeness constraint may be one of the following:


Total generalization or specialization, Partial
generalization or specialization. Which is the default?
a) Total
b) Partial
c) Should be specified
d) Cannot be determined
MCQ

• The completeness constraint may be one of the following:


Total generalization or specialization, Partial
generalization or specialization. Which is the default?
a) Total
b) Partial
c) Should be specified
d) Cannot be determined
MCQ

• Consider the employee work-team example, and assume


that certain employees participate in more than one work
team. A given employee may therefore appear in more
than one of the team entity sets that are lower level entity
sets of employee. Thus, the generalization is _____________
a) Overlapping
b) Disjointness
c) Uniqueness
d) Relational
MCQ

• Consider the employee work-team example, and assume


that certain employees participate in more than one work
team. A given employee may therefore appear in more
than one of the team entity sets that are lower level entity
sets of employee. Thus, the generalization is _____________
a) Overlapping
b) Disjointness
c) Uniqueness
d) Relational
References
• http
://www.engineering-bachelors-degree.com/database-softw
are/uncategorized/extended-e-r-features/
• https://generalizationcollection.blogspot.com/2019/07/the-
right-instance-of-generalization_17.html
• http://users.cms.caltech.edu/~donnie/dbcourse/intro0607/l
ectures/Lecture18.pdf

You might also like