edited by
13,005 views
6 votes
6 votes

I am confused whether we need to have 2 tables or a single table when 2 strong entities are in 1:1 relationship with one having complete participation.

Ex: 

How is it possible that we join Person and License into single table as some persons could be there without license as 'Person' participation is not total. Yes, there can not be any license without a person but persons can be without license. If we join these two tables that means some of the persons record may go away. And it could affect the referential integrity as Bank Account may refer to some of the Person records which may go away on joining Person and License.

edited by

2 Answers

4 votes
4 votes

If we have 

1) One to one relationship between two Entity

AND

2) Both side total participation

Then we can use 1 table for these both the entity and relationship.

Otherwise we needs two table.

If still there is any doubt then refer this Question : https://gateoverflow.in/168719/gateforum?show=168903#c168903

2 votes
2 votes
L
l1
l2
l3
l4

Above table is for the Licencse.Consider the below table for the Person.

P
p1
p2
p3
p4
p5

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.

A
a1
a2
a3

The relationship R2 is many to one from Account to Person and Account participate totally so

A P
a1 p1
a2 p2
a3 p2

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.

Related questions

1 votes
1 votes
2 answers
1
Srken asked Nov 12, 2021
1,656 views
I think it needs three tables but have lil bit confusion
1 votes
1 votes
2 answers
2
PEKKA asked Nov 29, 2016
1,457 views
Any Good Resource to study this topic ? Or Could anyone explain this topic to me ?
1 votes
1 votes
0 answers
4