- There are mainly two types of constraints apply to a specialization/generalization:
- Describes the relationship between members of the superclass and subclass and indicates whether a member of a superclass can be a member of one or more than one subclass.
- It may be disjoint or non-disjoint (overlapping).
- It specifies that the subclasses of the specialization must be disjointed (an entity can be a member of only one of the subclasses of the specialization).
- Specified by ‘d’ in EER diagram or by writing disjoint.
- It specifies that is the same entity may be a member of more than one subclass of the specialization.
- Specified by ‘o’ in EER diagram or by writing overlapping.
- Determines whether every member of the superclass must participate as a member of a subclass or not.
- Moreover, It may be total (mandatory) or partial (optional).
- Total specifies that every entity in the superclass must be a member of some subclass in the specialization.
- Specified by a double line in EER diagram.
- Partial specifies that every entity in the superclass does not belong to any of the subclasses of specialization.
- Also, Specified by a single line in EER diagram.
- Based on these two different kinds of constraints, a specialization or generalization can be one of four types:
- Total, Disjoint
- Total, Overlapping
- Partial, Disjoint
- Partial, Overlapping.
Aggregation in E-R diagram
- The E-R model cannot express relationships among relationships.
- When would we need such a thing at that time aggregation used.
- Also, Consider a database with information about employees who work on a particular project and use a number of machines doing that work.
- Relationship sets work and uses could combine into a single set. We can combine them by using aggregation.
- Moreover, Aggregation is an abstraction through which relationships are treated as higher-level entities.
- For our example, we treat the relationship set work and the entity sets employee and project as a higher-level entity set called work.
- Also, Transforming an E-R diagram with aggregation into a tabular form easy. We create a table for each entity and relationship set as before.
- Similarly, The table for relationship set uses contains a column for each attribute in the primary key of machinery and work.