Relationship Sets in E-R Model | GATE & UGC NET DBMS Notes
Relationship Sets in E-R Model
The Entity-Relationship (E-R) Model is a cornerstone in database design, helping to define how entities relate to one another. For aspirants of GATE, UGC NET, NIELIT, ISRO, and other competitive exams, understanding relationship sets is crucial for mastering database concepts.
What is a Relationship?
A relationship is an association among two or more entities. For example, in a university database:
- The relationship
advisor
links an Instructor (e.g., Katz) with a Student (e.g., Shankar), indicating that Katz is Shankar’s advisor.
What is a Relationship Set?
A relationship set is a collection of relationships of the same type. For example:
- The relationship set
advisor
associates multiple instructors with their respective students. - The relationship set
takes
links students to the sections of courses they are enrolled in.
The association between entity sets in a relationship set is called participation.
Key Features of Relationship Sets
1. Role of Entities
Entities play specific roles in a relationship. In some cases, such as recursive relationships, entities in the same set participate multiple times in different roles. For example:
- In the
prereq
relationship set, one course (C1) is the main course, and another (C2) is its prerequisite.
2. Descriptive Attributes
Relationships can have descriptive attributes to provide additional information. Examples include:
- The
advisor
relationship can include an attribute date to record when the advising began. - The
takes
relationship can include attributes like grade and credit.
Mapping Cardinalities in Relationship Sets
Mapping cardinalities specify how many entities in one set can be associated with entities in another. Types include:
- One-to-One: Each entity in A is linked to one entity in B and vice versa.
- One-to-Many: An entity in A is linked to multiple entities in B, but entities in B are linked to at most one entity in A.
- Many-to-One: Entities in A are linked to one entity in B, but entities in B can link to multiple entities in A.
- Many-to-Many: Entities in A and B can associate with multiple entities from each set.
Example: In a university database, the advisor
relationship is one-to-many, where one instructor advises multiple students, but each student has only one advisor.
Participation Constraints
Participation constraints define whether all entities in a set participate in a relationship:
- Total Participation: Every entity in the set participates in at least one relationship. Example: Every student has an advisor.
- Partial Participation: Some entities in the set participate in the relationship. Example: Not all instructors advise students.
Keys in Relationship Sets
Keys uniquely identify entities and relationships:
- A superkey for a relationship set includes the primary keys of all participating entity sets.
- The primary key for a relationship set depends on its mapping cardinality.
Conclusion
Understanding relationship sets, their mapping cardinalities, participation constraints, and keys is fundamental for designing robust databases. Mastering these concepts is essential for success in competitive exams like GATE, UGC NET, and NIELIT.