Presentation is loading. Please wait.

Presentation is loading. Please wait.

Unary Many-to-Many Relationship

Similar presentations


Presentation on theme: "Unary Many-to-Many Relationship"— Presentation transcript:

1 Unary Many-to-Many Relationship
CGS2540C Database Management

2 Unary Many-to-Many Relationship
A special case, an example of which has come to be known as the bill of materials problem. Every entity occurrence can be related to many other occurrences. A product can be a parent product – that is, it can be made of other products. A parent product can itself be used to make other parent products in which case it is known as a component product. Therefore a product can use many other products and that same product can be used by many other products. This is the many-to-many relationship. It is unary because only the Product entity is involved. Product Product

3 General Hardware Company’s Product Set
In this example product #48 uses many products (22, 24, 28). Product 48 can also be used on many products (53, 56). This is the many-to-many relationship. Tools and sets of tools are sold. Many-to-many nature of products.

4 Modified Product Relation
Product Numbers have been reduced to 2 digits for simplicity. Every individual unit item and every set of tools has its own row in the relation because every item and set is available for sale. In the previous example, product #48 used 22, 24, and 28. Product 48 was used on products 53 and All of these products have their own row in the table. (click)

5 Add Associative Entity
Just as a binary many-to-many relationship requires the creation of an additional relation in a relational database, so does a unary many-to-many relationship. The domain of values of each column is that of the Product Number column of the PRODUCT relation. So the primary key of the new table is Assembly plus Part. The Assembly column is a foreign key back to the Product number of the PRODUCT table (click) and Part is also a foreign key back to the Product number of the PRODUCT table. (click)

6 This completes the video!


Download ppt "Unary Many-to-Many Relationship"

Similar presentations


Ads by Google