Types of Relationships in DBMS
Types of Relationships
A relationship represents the association between two are more entities. On this page, we will learn about different types of relationships in DBMS.Types of Relationships in DBMS
- The relationship also shows the different entity sets that are participating in a relationship, these relationships are very much useful for analyzing the design process of the system.
- There are 5 types of relationships
Unary Relationship
Binary Relationship
n-ary Relationship
Recursive Relationship
Ternary Relationship
Unary relationship
When there is only one entity set participating in a relationship then such type of relationship is called unary relationship
Example of unary relationship
For example, a person has only one passport and only one passport is given to only one person and hence unary relationship is observed
Binary relationship
When there are exactly two entity sets participating in a relationship then such type of relationship is called binary relationship
Example of binary relationship
For example, a teacher teaches a subject here 2 entities are teacher and subject for the relationship teacher teaches subject
N-ary relationship
When a large number of entity sets are participating in a relationship, then such type of relationship is called an n-ary relationship
Example of n-ary Relationship
In the real world, a patient goes to a doctor and doctor prescribes the medicine and diagnosis to the patient, four entities Doctor, patient and medicine, diagnostics are involved in the relationship “prescribes”
Recursive relationship
A Recursive relationship is nothing but, simply an entity is having a relationship with self
Example of recursive Relationship
- The person who is a supervisor for many other employees also come under employees category
- Student can be a class monitor and handle other students but a person who is working as a class leader is itself a student of the class and hence a class monitor has a recursive relationship of entity student
Ternary relationship
When there are exactly three entity sets participating in a relationship then such type of relationship is called ternary relationship
Example of Ternary Relationship
In the real world, a patient goes to a doctor and doctor prescribes the medicine to the patient, three entities Doctor, patient and medicine are involved in the relationship “prescribes”
Prime Course Trailer
Related Banners
Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription
Get over 200+ course One Subscription
Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others
Login/Signup to comment