Presentation is loading. Please wait.

Presentation is loading. Please wait.

Converting ER model Into Relational Table

Similar presentations


Presentation on theme: "Converting ER model Into Relational Table"— Presentation transcript:

1 Converting ER model Into Relational Table
Tarek El-Shishtawy Professor Ass. Of Computer Engineering

2 Mapping Regular Entities
Each regular entity type in an ER diagram is transformed into a relation. The name given to the relation is generally the same as the entity type. Each simple attribute of the entity type becomes an attribute of the relation. – The identifier of the entity type becomes the primary key of the corresponding relation.

3 Example Entity name = Name of the relation or table.
Table PLAYER Player Name Nation Position Number of won Roger Federer Switzerland Roddick USA Entity name = Name of the relation or table. Attributes of ER diagram=Column name of the table.

4 Example using Oracle designer notations

5 Converting Composite Attribute
CUSTOMER Zip State City Street Name Customer-ID only the simple component attributes of the composite attribute are included in the relation.

6 Mapping Multivalued Attributes in ER
One way to map a multivalued attribute is to create two tables.

7 Converting “Weak Entities”
m 1

8 Converting “Weak Entities”
For each weak entity type, create a new relation All of the simple attributes as attributes of the relation. The primary key of the identifying relation as a foreign key attribute to this new relation. The primary key of the new relation is the combination of the primary key of the identifying and the partial identifier of the weak entity type. In this example DEPENDENT is weak entity.

9 Converting “Weak Entities”

10 Converting Binary Relationship Mapping one-to-Many Relationship
1 m One customer can give many orders.

11 Mapping one-to-Many Relationship

12 Using Oracle Designer notation

13 Binary one-to-one relationship
Can be viewed as a special case of one-to-many relationships. First, two relations are created, one for each of the participating entity types. Second, the primary key of one of the relations is included as a foreign key in the other relation. Example Parking place and employee

14 Many to Many relationships
M-M Needs an intersection table Note: Pre-requests requires more additional table

15 Many to Many relationships

16 Mapping Associative Entity to Tables Without Identifier

17 Mapping Associative Entity to Tables

18 Mapping Associative Entity to Tables With Identifier

19 Mapping Associative Entity to Tables With Identifier

20 Converting Unary Relationship
Each employee has exactly one manager. A given employee may manage zero to many employees. The foreign key in the relation is named Manager-ID

21 Converting Unary Relationship

22 Converting Ternary Relationship

23 Converting Ternary Relationship


Download ppt "Converting ER model Into Relational Table"

Similar presentations


Ads by Google