|
In this step the weak entity sets are transformed into the relational database scheme.
For each weak entity set S with owner G create a relational
scheme R with the entity properties as attributes A. For multivalued attributes
use rule 7. Use the primary key of G as foreign key in R. Choose a
discriminator (combination of attributes) that, together with the foreign key,
will act as primary key for R. Note that only the combination of the foreign
key together with the discriminator can act as primary key for R.
IIn this example you can see the application
of rule 2:
A weak entity set is taken for the creation of the
relation:
Part
All entity properties are used as attributes for the
relation:
Part(Name, Editor)
The primary key of the owner's relational scheme is taken
and added as a foreign key to the relation. In this example the owner is
Newspaper(Name, Circulation, Price) and the primary key is Name which we use in
the relation as NewspaperName (since Part already has a Name):
Part(NewspaperName, Name, Editor)
The discriminator attribute Name (of Part) together with
the foreign key NewspaperName form the primary key of the relation Part:
Part(NewspaperName, Name,
Editor)