Entity Relationship model (ER model) contains entities and relationships. ER model enables us to know how these entities are associated with each other. Entities interact with other entities through associations or relationships. Let us assume that Geeks is the name of a student, Placement 100 is the name of a course.
For example, student Geeks enrolls in Placement 100 course.
Here, enrolls is the name of the relationship.
This is only one instance of the relationship. There can be several instances and several other people joining several courses. The relationship enrolls has the student and course as the participating entity sets.
Mathematically, we represent the above as, enrolls is a subset of the cross product of student and course. It has information about which student has enrolled into which course. If (s, c) belongs to enrolls, it would mean that the student s has enrolled in course c. Tuples in enrolls table are known as relationship instances whereas, enrolls is called a relationship type or set. Relationship type contains the collection of associations of the same kind.
Degree of a relationship :
This is used to demonstrate the number of entities which are a part of the given relationship. Degree 2 is called binary relationship and it means that 2 entities are participating in the relationship. It is the most commonly used relationship. Degree 3 is called ternary relationship. Degree n is called n-ary relationship. The tuples should have components which are equivalent to the degree of the relationship.
Diagrammatic Notation for Relationships :
Relationship is represented by a diamond shaped box. Rectangle represents participating entities.
Rectangle of the entity is connected to the diamond of the relationship by a line. The names of entities and relationships is written in their specified shapes. The lines specify connections between the entities and their relationships.
Entities have several other attributes which are not mentioned in the picture.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.