Aggregation Association
Database Essentials - Part 7
Division 1
Forward: In this part of the series, we look at what is called the Aggregation Association. This is another kind of relationship we have to learn.
By: Chrysanthus Date Published: 4 Aug 2012
Introduction
Table Example
You will have to open the following link in a browser tab in order to see the tables and diagrams of this tutorial (link below).
Table 7.1 shows a Sale table (sample) and Table 7.2 shows the corresponding Sale Item table (sample) for a wholesale company. We have seen these tables before. However, we shall look at them now from a different light. The Sale with ID 10 in the Sale table has the corresponding sale items of the first three rows of the Sale Item table. The Sale with ID 20 in the Sale table has the corresponding sale items of the fourth and fifth rows of the Sale Item table. The Sale with ID 30 in the Sale table has the corresponding sale items of the sixth, seventh and eighth rows of the Sale Item table.
We say the Sale with ID 10 has a collection of three rows (the first three) in the Sale Item table. We say the Sale with ID 20 has a collection of two rows (fourth and fifth) in the Sale Item table. We say the Sale with ID 30 has a collection of three rows (sixth, seventh and eighth) in the Sale Item table. The word, “collection” here does not have exactly the same meaning as it has in classical object technology; however, that is not a big deal.
So from the tables, we say that a Sale consists of a collection of items. The aggregation or collection relationship is between each sale and its collection of items. We normally say an aggregation relationship can exists between two entities (tables). Here, an aggregation relationship exists between the Sale and Sale Item tables. The way to denote this with a class diagram is shown in fig. 7.1.
In the diagram the Sale class is called the aggregate. A line connects the two classes (tables). The line has a diamond end on the aggregate side.
That is it for Aggregation relationship. Let us take a break here and continue in the next part of the series.
Chrys
Related Links
Major in Website DesignWeb Development Course
HTML Course
CSS Course
ECMAScript Course
NEXT