ExtendedER Design Part2
ExtendedER Design Part2
DATABASE DESIGN
Extended ER Features
Extended E-R Features: Specialization
• Top-down design process; we designate subgroupings within an
entity set that are distinctive from other entities in the set.
• The process of designating subgroupings within an entity set is
called specialization.
Advantage ?
Representing Specialization via
Schemas
• Method 1:
• Form a schema for the higher-level entity
• Form a schema for each lower-level entity set, include
primary key of higher-level entity set and local attributes
schema attributes
person ID, name, street, city
student ID, tot_cred
employee ID, salary
• Overlapping
• an entity can belong to more than one lower-level entity set
Specialization/Generalization Example
Design Constraints on a
Specialization/Generalization (Cont.)
Completeness constraint -- specifies whether or
not an entity in the higher-level entity set must
belong to at least one of the lower-level entity sets
within a generalization.
total: an entity must belong to one of the lower-level
entity sets
partial: an entity need not belong to one of the lower-
level entity sets
Total: student must belong to either graduate or
undergraduate
Example for partial:
• Employee’s Subclass are S/W Engineers and Quality Engineers
Aggregation
Consider the ternary relationship proj_guide, which we saw earlier
Suppose we want to record the evaluations of a student by a guide on a
project
Aggregation (Cont.)
Without introducing redundancy, the following diagram represents:
A student is guided by a particular instructor on a particular project
A student, instructor, project combination may have an associated
evaluation
Allows relationships between relationships
Abstract entity
• Aggregation is an abstraction through which relationships are treated
as higher-level entities. Thus the relationship between entities and is
treated as if it were an entity .
Schemas Corresponding to Aggregation
To represent aggregation, create a schema containing
primary key of the aggregated relationship,
the primary key of the associated entity set
any descriptive attributes
eval_for (s_ID, project_id, i_ID, evaluation_id)
• Employees work for projects. An employee working for a particular
project uses various machinery.
• Manufacturers have tie-ups with distributors to distribute products.
Each tie-up has specified for it the set of products which are to be
distributed.
Design issues
Design• Use
Issues
of entity sets vs. attributes
One possible guideline in determining whether to use an entity set or a relationship set is to designate a relationship set to
describe an action that occurs between entities. This approach can also be useful in deciding whether certain attributes may be
more appropriately expressed as relationships.
Design• Binary
Issues versus n-ary relationship sets
Although it is possible to replace any nonbinary (n-
ary, for n > 2) relationship set by a number of distinct
binary relationship sets, a n-ary relationship set
shows more clearly that several entities participate in
a single relationship.
Binary Vs. Non-Binary Relationships
• Some relationships that appear to be non-binary
may be better represented using binary
relationships
• E.g., A ternary relationship parents, relating a child to
his/her father and mother, is best replaced by two
binary relationships, father and mother
• Using two binary relationships allows partial information (e.g.,
only mother being know)
• But there are some relationships that are naturally
non-binary
• Example: proj_guide
Converting Non-Binary Relationships to Binary Form