You are on page 1of 3

C0NP0TER APPLICATI0N-II

ASSIuNNENT


10/24/2010
vlnCu L8kASP (9292)


TYPES OF DATABASE RELATIONSHIPS

There are three types of relationships.
1. One-to-one relationship
2. One-to-many relationship
3. Many-to-many relationship


One-to-One ReIationship
n one-to-one relationship, two tables are associated in such a way that each record in first table can
have only one matching record in second table, and each record in second table can have only one
matching record in first table. Consider the relationship between countries and their capitals given
below.

One to One Relationship


2 One-to-Many ReIationship
n one-to-many relationship, two tables are associated in such a way that each record in the first table
can have many matching records in second table, but a record in second table has only one matching
record in first table.
ko|| No Name C|ty
1 Shahbaz Lahore
2 8ashld MulLan
3 Mukaram karachl
4 Shakeel lalsalabad
3 nusraL SlalkoL
Student Table
ko|| No hone No
1 7334313
1 0391643369
2 7397696
2 0303030303
3 7392077
3 09798303269
4 77411198
4 +4466396363
Student Phone Table
or example, the student table has unique records and each Roll_no in student table may have more
than one phone numbers in "student phone table, on the other hand when you see records in
"student phone table, each record in. it has only one matching record in "student table
Many-to-Many ReIationship
n many-to-many relationship, two tables are associated in such a way that each record in the first
table can have many matching records in second table, and a record in second table can have many
matching records in first table.

Many to Many Relationship
Suppose two sisters are in the same school. The relationship between two entities is shown above. n
the above relationship, each record in the left side has two records in right side. Similarly, each record
in the right side has two related records in left side.

You might also like