Above table is for the Licencse.Consider the below table for the Person.
As the relationship is one-to-one and License participates totally then the table for relationship will be
L |
P |
l1 |
p1 |
l2 |
p2 |
l3 |
p3 |
l4 |
p4 |
The primary keys will be L and P.
In case of one-to-one relationship we can merge it with any side entity.We can notice that if it is merged with L then it will not be altered.Now if we merge it with the person table then the table will look like
L |
P |
l1 |
p1 |
l2 |
p2 |
l3 |
p3 |
l4 |
p4 |
NULL |
p5 |
Now the three tables Person,License and relationship R1 are merged without any violation of the database constraints for 1NF.But for this table L can not be primary key any more because of NULL value.So P will be the new primary key.
Now consider the Account entity and the relationship R2.
The relationship R2 is many to one from Account to Person and Account participate totally so
Now the primary key will be A as there is duplicate value for P attribute.This relationship can be merged with A and primary key will be same.But if we try to merge it with the entity P then the merged relationship will be
A |
P |
a1 |
p1 |
a2 |
p2 |
a3 |
p2 |
NULL |
p4 |
NULL |
p5 |
NULL |
p6 |
Now for this relationship we can not assign a primary key.P can not be as it has duplicate and A can not be as it has NULL value.
So relationship can not be merged with Person.So we need two separate table one for Person and one for Account and R2.
Now previously we saw that the tables Person,R1 and License can be merged into a single table so we need one table.
So total number of tables needed will be 2.