Consider two entity sets A and B that both have the attribute X (among others whose
names are not relevant to this question).
a. If the two Xs are completely unrelated, how should the design be improved?
b. If the two Xs represent the same property and it is one that applies both to A and to
B, how should the design be improved? Consider three subcases:
X is the primary key for A but not B
X is the primary key for both A and B
X is not the primary key for A nor for B
a. If the val attribute in two entites are completely unrelated, how should the design be improved?
answer : Basically it does not creating any problem When only one one person ( creator ) is managing the relations. But for easy understanding to some one else ,more preferable option is changing one of the attribute name
b. If the val attribute in two entites represent the same property and it is one that applies both to A and to B, how should the design be improved?
- val is the primary key for A but not B
answer : when "val" attribute in two entites represent the same property that applies to both to A and to B .we can use Referential integrity (foreign key ) . eg:- foreign key in B ("val") Referencing primary key in A "val"
- val is the primary key for both A and B
answer :if val is the primary key of both A& B . it would be better to combine the table and make it as single table if the table has small number of attributes.
Usually , to seperate a table which has large number of attributes, the above methode is used (same primary key for both relation A and B )
- val is not the primary key for A nor for B
answer : if "val" is a non key in both relation A & B. there is a high chance of Data redutancy . ofcourse two tables can have same column name . But if they represent same property ,they should be connected either way and unique eg: foreign key "val" in B refers to a non-primary unique key "val" in A
Comments
Leave a comment