Entity Relationship Diagram
Entity relationship diagrams express the logical structure of a database the main components of entity relationship diagram are :
- Rectangle Entity set
- Ellipse Attributes
- Diamonds Relatiohship stes
- Lines Linkd attributes to entity sets and entity sets to relationship sets
- Double ellipse Multivalued attributes
- Dotted ellipse Derived attributes
- Double line Total participation of entity in relationship sets
- Weak entity
- Identifying relationship for weak entity set
Translating Tables into ERD
- The following rules can be followed to convert tables into ERD
- Create a table for all strong entities and column for all attributes. If an attribute is a composite attribute then create columns only for sub attributes.
- Do not create any column for derived attributes as they would not be included in the table.
- Create separate table for multivalued attribute and the primary key of the entity would be added as a column to the table of the multivalued attribute.
- Similarly create separate table for weak entity and the primary key of weak entities/multivalued attributes is formed by combining partial key of weak entity and primary key of strong entity to which the weak entity is related to.
- Tables for relations depend upon the cardinality of the relationship. For one to many and one to one there is no need to create separate tables.
- For many to many, create a separate table for relationship and add primary key by combining the primary key of both the entities.