Types of Relationships in Relational Model: One-To-One Relationships, One-To-Many Relationship, & Many-To-Many Relationship (Especially for GATE-Geospatial 2022)

Get unlimited access to the best preparation resource for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Examrace Books on Mapping, GIS, and Remote Sensing prepares you throughly for a wide range of practical applications.

Relational Model

In general, a relation schema may have more than one key. Each of these is called a candidate key. One of them is designed as the primary key of the relation. The primary key will be used to identify tuples in the relation.

There are main four types of relationships:

This Figure Shows Three Types of Relationships

1. One-To-One Relationship

If the data requires that one record in the parent table be related to only one record in the child table, you have a one-to-one model. The most common use of one-to-one relations is to create separate entity classes to enhance security. In a hospital, for example, each patient՚s data is a single entity class but it makes sense to create separate tables for the patient՚s basic information and his or her medical history.

This Image Shows One-To-One Model

2. One-To-Many Relationship

The most common relational model is one where a single record in the parent table relates to multiple records in the child table. This is called a one-to-many relationship. The sales leads example is a one-to-many relationship because one record in the companies table can relate to many records in the contacts table. In these models, the “many” table is the one where you add the foreign key.

This Image Shows One-To-Many Model

3. Many-To-Many Relationship

In some cases, you might have data in which many records in one table can relate to many records in another table. This is called a many-to-many relationship. In this case, there is no direct way to establish a common field between the two tables.

This Image Shows Many-To-Many Model

For example, each customer may place an order for many products, and each product might be ordered by many customers. This is the kind of relationship that must be converted into two one-to-many relationships by the addition of a so-called linking table.

Key

The model uses a special attribute called a key to link between different data files

Developed by: