0% found this document useful (0 votes)
29 views

Name Toki Omotayo MATRIC NUMBER: P/HD/19/3630026 Class: HND 2

This document discusses database relationships. It defines three types of relationships: one-to-one, one-to-many/many-to-one, and many-to-many. One-to-one relationships exist when each record in one table is related to only one record in another table. One-to-many/many-to-one relationships exist when each record in one table can be related to one or more records in another table. Many-to-many relationships exist when each record in one table can be related to multiple records in another table, and vice versa. Many-to-many relationships require a linking table to connect the two tables. In Access, relationships can be created by dragging fields between

Uploaded by

toki ezekiel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Name Toki Omotayo MATRIC NUMBER: P/HD/19/3630026 Class: HND 2

This document discusses database relationships. It defines three types of relationships: one-to-one, one-to-many/many-to-one, and many-to-many. One-to-one relationships exist when each record in one table is related to only one record in another table. One-to-many/many-to-one relationships exist when each record in one table can be related to one or more records in another table. Many-to-many relationships exist when each record in one table can be related to multiple records in another table, and vice versa. Many-to-many relationships require a linking table to connect the two tables. In Access, relationships can be created by dragging fields between

Uploaded by

toki ezekiel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

NAME TOKI OMOTAYO

MATRIC NUMBER : P/HD/19/3630026

CLASS: HND 2

WHAT IS RELATIONSHIP IN DATABASE

A relationship, in the context of databases, is a situation that exists between two relational database
tables when one table has a foreign key that references the primary key of the other table.
Relationships allow relational databases to split and store data in different tables, while linking
disparate data items.

THE TYPE OF RELATIONSHIP IN DATABASE


 One-to-One Relationship.
 One-to-Many or Many-to-One Relationship.
 Many-to-Many Relationship.

One-to-One Relationship
Such a relationship exists when each record of one table is related to only one record of the other
table.

For example, If there are two entities ‘Person’ (Id, Name, Age, Address)and ‘Passport’(Passport_id,
Passport_no). So, each person can have only one passport and each passport belongs to only one
person.

Such a relationship is not very common. However, such a relationship is used for security purposes.
In the above example, we can easily store the passport id in the ‘Person’ table only. But, we make
another table for the ‘Passport’ because Passport number may be sensitive data and it should be
hidden from certain users. So, by making a separate table we provide extra security that only certain
database users can see it.
One-to-Many or Many-to-One Relationship
Such a relationship exists when each record of one table can be related to one or more than one
record of the other table. This relationship is the most common relationship found. A one-to-many
relationship can also be said as a many-to-one relationship depending upon the way we view it.

For example, If there are two entity type ‘Customer’ and ‘Account’ then each ‘Customer’ can have
more than one ‘Account’ but each ‘Account’ is held by only one ‘Customer’. In this example, we can
say that each Customer is associated with many Account. So, it is a one-to-many relationship. But, if
we see it the other way i.e many Account is associated with one Customer then we can say that it is a
many-to-one relationship.

Many-to-Many Relationship
Such a relationship exists when each record of the first table can be related to one or more than one
record of the second table and a single record of the second table can be related to one or more than
one record of the first table. A many-to-many relationship can be seen as a two one-to-many
relationship which is linked by a 'linking table' or 'associate table'. The linking table links two tables
by having fields which are the primary key of the other two tables. We can understand this with the
following example.

Example: If there are two entity type ‘Customer’ and ‘Product’ then each customer can buy more
than one product and a product can be bought by many different customers.

Now, to understand the concept of the linking table here, we can have the ‘Order’ entity as a linking
table which links the ‘Customer’ and ‘Product’ entity. We can break this many-to-many relationship
in two one-to-many relationships. First, each ‘Customer’ can have many ‘Order’ whereas each ‘Order’
is related to only one ‘Customer’. Second, each ‘Order’ is related only one Product wheres there can
many orders for the same Product.
In the above concept of linking can be understood with the help of taking into consideration all the
attributes of the entities 'Customer', 'Order' and 'Product'. We can see that the primary key of both
'Customer' and 'Product' entity are included in the linking table i.e 'Order' table.

HOW CAN WE RELATE TABLES TO RELATIONSHIP IN MSACESS

In an Access database, you create a table relationship using one of the following methods: In the
Relationships window, add the tables that you want to relate, and then drag the field to relate them
from one table to the other table. Drag a field on to a table.

References: TOKI OMOTAYO

You might also like