Entity Relationship Model (ER)
Entity- An entity can be a real world object that can be easily identified. It is a piece of concept about which data is stored.
For example- In a school, students, teachers, classes, and courses considered as entities. All these entities have some attributes or properties that give them their identity.
Relationships between Entities
A Relationship is association among entities. There are three types of relationships between entities
- One to one
- One to many
- Many to many
One to One relationship- One entity from entity set A will be related to at the most one entity of entity set B and contrariwise (vice-versa) of it.
For example- There is only one department head in a department so it is one to one relationship.
One to Many relationship − More than one entities from entity set A will be related to at the most one entity of entity set B, however an entity from entity set B can be related with more than one entity from entity set A.
For example- There is only one class teacher among students so this shows many to one relationship.
Many to Many relationship − One entity from A can be associated with more than one entity from B and vice versa of it.
For example- Many courses having many students, many students doing many courses.