Exaplain with example how ER diagram is converted into tables.

Step 1 − Conversion of strong entities

For each strong entity create a separate table with the same name.

Includes all attributes, if there is any composite attribute divided into simple attributes and has to be included.

Ignore multivalued attributes at this stage.

Select the p key for the table.

Step 2 − Conversion of weak entity

For each weak entity create a separate table with the same name.

Include all attributes.

Include the P key of a strong entity as foreign key is the weak entity.

Declare the combination of foreign key and decimator attribute as P key from the weak entity.

Step 3 − Conversion of one-to-one relationship

For each one to one relation, say A and B modify either A side or B side to include the P key of the other side as a foreign key.

If A or B is having total participation, then that should be a modified table.

If a relationship consists of attributes, include them also in the modified table.

Step 4 − Conversion of one-to-many relationship

For each one to many relationships, modify the M side to include the P key of one side as a foreign key.

If relationships consist of attributes, include them as well.Step 5 − Conversion of many-many relationship

For each many-many relationship, create a separate table including the P key of M side and N side as foreign keys in the new table.

Declare the combination of foreign keys as P for the new table.

If relationships consist of attributes, include them also in the new table.

Step 6 − Conversion of multivalued attributes

For each multivalued attribute create a separate table and include the P key of the present table as foreign key.

Declare the combination of foreign key and multivalued attribute as P keys.

Step 7 − Conversion of n-ary relationship

For each n-ary relationship create a separate table and include the P key of all entities as foreign key.

Declare the combination of foreign keys as P key.

Popular posts from this blog

Explain any five relational algebra operators.

. What is join? Explain the types of join with example.