- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Binary Relationship in Database
A Binary Relationship is the relationship between two different Entities i.e. it is a relationship of role group of one entity with the role group of another entity.
There are three types of cardinalities for Binary Relationships −
1. One-to-One
2. One-to-many
3. Many-to-Many
One-to-One
Here one role group of one entity is mapped to one role group of another entity. In simple terms one instance of one entity is mapped with only one instance of another entity.
In this type the primary key of one entity must be available as foreign key in other entity.
For example − consider two entities Person and Driver_License.
Person has the information about an individual and Driver_License has information about the Driving License for an individual. The relationship from Driver_License to Person is optional as not all People have driving license. Whereas the relationship from Person to Driver_License is compulsory i.e. every instance of Driver_License must be related to one Person.
One Person should have only one Driver License number.
One-to-Many
One role group of one entity is mapped with many role groups of second entity and one role group of second entity is mapped with one role group of first entity.
For Example − consider two entities Project and Employee.
One Project can have many Employees working on it but one Employee will always be engaged in only one Project.
Many-to-Many
One role group of one entity is mapped with many role groups of second entity and one role group of second entity is mapped with many role groups of first entity. In these kind of relationships a third table is always associated that defines the relationship between the two entities.
For example − Consider two entities Student and Books.
Many Students can have a Book and many Books can be issued to a Student so in this way this is a many-to-many relationship.
Now in between there would be a third relation Book_Issue that defines the relationship between Student and Book entities. It will contain the information for every Student that is issued a Book and for how many days i.e. it will keep track for all the Books issued.
- Related Articles
- Ternary Relationship in Database
- Entity Relationship Participation in Database
- N-ary Relationship in Database
- Importance of Entity-Relationship diagram in database design
- HAS-A relationship in Java
- is-a relationship in Java
- How can we establish MySQL database by using MySQL binary at command\nprompt?
- Entity-Relationship Diagram
- Brain Behavior Relationship
- Attitude Behavior Relationship
- One-to-One Relationship in DBMS
- Many-to-Many Relationship in DBMS
- Unary or Recursive Relationship
- What Is Symbiotic Relationship
- Interpersonal Attraction and Relationship
