11.1 KB · commit 40bb182
← Previous: T02.7: EER Specialization and Generalization | 🏠 Index | Next: T03.1: Relation, Tuple, Attribute, and Domain →
Topic: T02 — E-R & EER Modeling | Priority: 🟡 Medium | Exam Frequency: 2/7 finals (5 marks: 2018 Q2b, 2020 Q3a) Sources: Silberschatz 7e Ch. 6 (§6.8.5, §6.8.6.2) · Lecture Deck 05 (Slides 57–60) · Class Notes
Basic Entity-Relationship (E-R) diagrams have a strict drawing rule: a relationship diamond can only connect to entity rectangles, never directly to another relationship diamond. But what happens when you need to record an action about an existing relationship (such as an evaluation filed for a specific student-instructor-project guidance assignment)? Aggregation solves this problem by drawing a box around the first relationship so the rest of the diagram can treat it just like a regular entity. In RUET finals, this appears as both a 2-mark definition question (2020 Q.3(a)) and a 3-mark question asking for two real-world examples (2018 Q.2(b)).
Aggregation: Aggregation is an EER abstraction that treats an entire relationship set and its participating entity sets as a single higher-level entity set. In an E-R diagram, a rectangular bounding box is drawn around the inner relationship so it can connect to other relationships without duplicating data.
In basic E-R modeling, a relationship diamond can only link entity rectangles. You are never allowed to draw a line from one diamond straight to another diamond.
To see why that becomes a problem, picture a university project scenario with three entity sets: instructor, student, and project. They are connected by a ternary relationship diamond called proj_guide (meaning a specific instructor guides a specific student on a specific project). Now suppose the university requires the instructor to submit periodic evaluation reports on how that guidance assignment is going.
If we try to model this using only basic E-R shapes, both of our options are flawed:
eval_for diamond directly to the proj_guide diamond.proj_guide (3-way) and also draw a separate 4-way relationship eval_for linking instructor, student, project, and evaluation (as shown in Figure 1), every evaluated team has its (instructor, student, project) pairing stored twice. Worse yet, we cannot simply delete proj_guide and keep only eval_for, because a newly formed project team must be recorded in the database before it receives its first evaluation!
Figure 1: Motivation for aggregation showing redundant relationship sets proj_guide and eval_for (Source: Lecture Deck 05, Slide 57).
Aggregation fixes this cleanly by letting you "package" an entire relationship into a single box:
proj_guide diamond and its three participating entity sets (instructor, student, and project).evaluation using an ordinary binary relationship diamond called eval_for.proj_guide, even if they have zero evaluations so far. Whenever an evaluation is filed, eval_for simply links the evaluation ID to that aggregated team.
Figure 2: Aggregation representation in an E-R diagram. The bounding box treats proj_guide as an abstract entity connected to evaluation via relationship eval_for (Source: Lecture Deck 05, Slide 59).
Students often wonder if the aggregate bounding box gets its own table or needs a brand-new ID column. It does not! The bounding box is just a visual wrapper around the inner relationship (proj_guide). Because of this, the primary key of the aggregate box is simply the composite primary key of the relationship inside it: (s_id,project_id,i_id).
When we convert Figure 2 into relational tables, we follow two simple steps:
student, project, and instructor:
proj_guide(s_id,project_id,i_id)eval_for combines the primary key of the aggregate box with the primary key of evaluation (plus any descriptive attributes on eval_for):
eval_for(s_id,project_id,i_id,evaluation_id)
(Note: If each evaluation report belongs to only one guidance team, meaning eval_for is many-to-one from evaluation to proj_guide, you can even merge (s_id, project_id, i_id) directly into the evaluation table!)Suppose student S1 works on project P10 under instructor I5, and student S2 just started project P20 under instructor I8 (no evaluation yet):
proj_guide table: Holds (S1, P10, I5) and (S2, P20, I8). Both active teams are safely recorded even though S2 has no evaluation yet.eval_for table: Holds (S1, P10, I5, E101) and (S1, P10, I5, E102) for two monthly evaluations of S1's project, referencing (S1, P10, I5) in proj_guide via a composite foreign key.| Year & Question | Marks | Scenario / Data Given | Key Result / Answer Summary |
|---|---|---|---|
| 2018 Q.2(b) | 3 | Theoretical definition with practical utility requirement | Define aggregation as an abstraction treating relationships as entities. Provide two concrete examples (Project Guidance Evaluation and Employee Task Monitoring). |
| 2020 Q.3(a) | 2 | Core concept definition in E-R design | Concise definition of aggregation, limitation of standard E-R, and bounding box diagram sketch. |
Appeared: 2018 Q.2(b) — (3 marks)
Question:
Define the concept of aggregation. Give two examples of where this concept is useful.
Full Answer:
1. Definition of Aggregation: Aggregation is an abstraction in the Extended Entity-Relationship (EER) model through which a relationship set is treated as a higher-level abstract entity set. This allows a relationship to participate in further relationships with other entity sets without introducing redundancy.
Why it is needed: In basic E-R modeling, relationships cannot be connected directly to other relationships. Aggregation overcomes this limitation by enclosing the relationship and its participating entities inside an abstract entity boundary.
2. Two Examples Where Aggregation is Useful:
Example 1: Student Project Guidance and Evaluation Report
Consider the ternary relationship proj_guide associating student, instructor, and project. Suppose an instructor must submit an evaluation report for that specific student-project pairing. Connecting evaluation directly to the three entities creates a redundant 4-way relationship. By aggregating proj_guide into a single higher-level entity, the entity evaluation links cleanly to proj_guide through a binary relationship eval_for.
Example 2: Employee Job Assignment and Manager Monitoring
Consider employees working on projects through the relationship Works_On(employee, project). A department manager needs to monitor that specific work assignment. A binary relationship between manager and Works_On is illegal in basic E-R. By aggregating Works_On(employee, project) into an entity, the manager entity participates directly in a relationship Monitors with the aggregate entity.
Appeared: 2020 Q.3(a) — (2 marks)
Question:
What is aggregation in ER-model design?
Full Answer:
Aggregation in E-R Model Design: Aggregation is an abstraction construct in E-R modeling where a relationship set, along with its participating entity sets, is treated as a single higher-level abstract entity set.
Purpose and Representation:
AVG(), COUNT(), and SUM(). E-R aggregation is an abstraction mechanism that treats a relationship as an entity.proj_guide with eval_for example is taken straight from Silberschatz and Lecture Deck 05. Memorize it for full marks.← Previous: T02.7: EER Specialization and Generalization | 🏠 Index | Next: T03.1: Relation, Tuple, Attribute, and Domain →