TOPICS (Click to Navigate)

Pages

Thursday, February 12, 2015

Reduction of Weak Entity set to relation schema.

How to convert Weak entity set into relation schema?



Weak Entity set is an entity set which does not have enough attributes to form a Primary key. While converting weak entity set into relation schema, the following procedure is followed;

  • Take the Primary key of Strong entity set in which the Weak entity set depends. Then include the primary key into the relation schema of weak entity set along with other attributes of weak entity set.

Figure 1 - ER Diagram for Weak entity and relationships


Let us consider the ER diagram given below, where Apartment entity set is the Weak entity set with the Discriminator ADoor_No. Apartment stores information regarding the individual apartment details in any building. Hence, a building can have many floors with more apartments in every floor. Suppose, if we number every apartment with 1, 2, 3 and so on, then there are other buildings with same door numbers. Hence, ADoor_No cannot be the Primary key. Apartment is totally participated on Strong Entity set Building_Details through the weak relationship set BA for existence. That is, for every record in Apartment, we must have a related record in Building_details.
The relation schema Apartment will contain all the attributes of Apartment along with the Primary key of Strong entity set Building_Details. Thus, we have the following schema;
Apartment ( Building_No, ADoor_No, Floor, Rent)
The strong entity set Building_Details as follows;
Building_Details (Building_No, Building_Name, Total_Apartments, Address)

Points to note:

The relationship BA need not be converted into table. In other words, the relationship between strong and weak entity set is one-to-many. We shall see that in the post Relationship set into relation schema.


1 comment:

  1. this was very helpful! I am working on an assignment for my database systems class and just couldnt figure out what to do about the keys. Thanks so much!

    ReplyDelete