Presentation is loading. Please wait.

Presentation is loading. Please wait.

Transforming ER models to relational schemas

Similar presentations


Presentation on theme: "Transforming ER models to relational schemas"— Presentation transcript:

1 Transforming ER models to relational schemas
Transformation FEN

2 Design of Relational Tables
The conceptual model must be transformed to an implementation model, e.g. relational schemas. This can be done using a seven (or 8 or…)steps algorithm. Does not always yield an optimal design, but provides a good starting point for the final design of tables. Transformation FEN

3 Design of Relational Tables
Step 1: For each regular entity create a table: For composite attributes only the components are included. Multi-value attributes are not included (they are considered in step 6). Choose a primary key. FEN

4 Design of Relational Tables
Step 2: For each weak entity create a table All attributes from the weak entity are included. The primary key from the owner is included as foreign key. The primary key is composed by the owner’s primary key and the partial key. FEN

5 Design of Relational Tables
Step 3: For each (binary) 1:1-relation include the primary key of one participant as foreign key in the other Any attributes on the relation are included with the key. If possible, include on a side with total participation. FEN

6 Design of Relational Tables
Step 4: For each (binary) 1:n relation include primary key of 1-side as foreign key on n-side Any attributes on the relation are included with the key on the n-side. FEN

7 Design of Relational Tables
Step 5: For each (binary) n:m relation create table with the primary keys of participating entities as foreign keys Any attribute on the relation is included in the new table. Primary key is composed of the foreign keys. This may also be applied to binary 1:1- and 1:n relations – in particularly if there are relatively few instants of the relation. FEN

8 Design of Relational Tables
Step 6: For each multi value attribute create a table with primary key of the entity as foreign key and the multi value attribute The primary key of the new table is composed of the foreign key and the multi value attribute. FEN

9 Design of Relational Tables
Step 7: For each n-ary (n>2) relation create a table with the primary keys of all participating entity as foreign keys Any attribute on the relation is included. The primary key is composed of the included foreign keys. FEN

10 Design of Relational Tables
Result: FEN

11 Example/Exercise (Elmasri)
Use the seven steps algorithm to design tables for this database. FEN


Download ppt "Transforming ER models to relational schemas"

Similar presentations


Ads by Google