Home | | Computer Science 12th Std | Types of Relationships in a database

Database Concepts - Types of Relationships in a database | 12th Computer Science : Chapter 11 : Database concepts and MySql : Database Concepts

Chapter: 12th Computer Science : Chapter 11 : Database concepts and MySql : Database Concepts

Types of Relationships in a database

Following are the types of relationships used in a database.

Types of Relationships

Following are the types of relationships used in a database.

1.     One-to-One Relationship

2.     One-to-Many Relationship

3.     Many-to-One Relationship

4.     Many-to-Many Relationship

 

1. One-to-One Relationship

In One-to-One Relationship, one entity is related with only one other entity. One row in a table is linked with only one row in another table and vice versa.

For example: A student can have only one exam number


 

2. One-to-Many Relationship

In One-to-Many relationship, one entity is related to many other entities.

One row in a table A is linked to many rows in a table B, but one row in a table B is linked to only one row in table A. For example: One Department has many staff members.


 

3. Many-to-One Relationship

In Many-to-One Relationship, many entities can be related with only one in the other entity.

For example: A number of staff members working in one Department.

Multiple rows in staff members table is related with only one row in Department table.


 

4. Many-to-Many Relationship

A many-to-many relationship occurs when multiple records in a table are associated with multiple records in another table.

Example 1: Customers and Product

Customers can purchase various products and Products can be purchased by many customers

Example 2: Students and Courses

A student can register for many Courses and a Course may include many students

Example 3: Books and Student.

Many Books in a Library are issued to many students.



 

Tags : Database Concepts , 12th Computer Science : Chapter 11 : Database concepts and MySql : Database Concepts
Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
12th Computer Science : Chapter 11 : Database concepts and MySql : Database Concepts : Types of Relationships in a database | Database Concepts


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.