For a binary relationship set explain how primary key is sel
For a binary relationship set, explain how primary key is selected in case of each of the following:
i.One-to-one relationship
.ii.Many-to-many relationship
iii.Many-to-one or one-to-many relationship
Solution
To select primary key in:
1) One-to-One relationship
In one-to-one relationship, two different entities are associated with each other using single entity.That single entity can be used for primary key. When selecting your primary key be careful and choose numeric type as they are easy to store.
2) Many-to-many relationship
In this relationship you can create autonumber primary key. Else you can go with composite primary key that consists of two foreign keys.
3)one to many relationship
ex. a user can have mltiple address like temporary address, permanent address,email address,etc.This is the example of one to many relationship.
so we can choose a primary key as address mapping but we willneed to define the foreign key also. so that foreign key will create the link between the tables.Also the foreign key will represent the many term from one to many relationship.
So primary key will always one single and unique row of data.
