An Entity Relationship diagram is a graphical representation of all objects coming under system boundary. It has three components called entity, relationship and cardinality.
Components of ER diagram
- Entities – represented by rectangles
- Relationships – represented by diamonds.
- Attributes – represented by ovals.
- Cardinality- represented by lines.
How to construct an ER Diagram
First we identify all entities coming under the system. A rectangle used to draw entities which describe data stored in it. Then we find the relationship between these entities. Diamond shapes used to represent relationships. Then we connect entities with relationship using lines. Then we add attributes of these entities using oval shaped symbols and link it with lines. We need to ensure that each entity appears only once in the diagram. ER diagram is ready once we properly define all entities and its relationships.
Relationships between entities
The most important portion in ER diagrams identifies and draws the relationships. Following are the types of relationship can exist between entities.
One- to- One: When there is only one instance of an entity is associated with the relationship; it is called as 1:1 (one to one)
One –to- many: When more than one instance of an entity is associated with a relationship; It is marked as 1:N(one to many)
Many – to- One: When more than one instance of entity is associated with the relationship; it is marked as N:1(many to one)
Many – to- many: If more than one instance of one entity on the left side and more than one entity on the right side is associated to a relationship; it is marked as N:N ( many to many)