1 / 23

Converting ER model Into Relational Table

Converting ER model Into Relational Table. Tarek El-Shishtawy Professor Ass. Of Computer Engineering. 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.

herrin
Download Presentation

Converting ER model Into Relational Table

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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. • Attributes of ER diagram=Column name of the table. Table PLAYER Player Name Nation Position Number of won Roger Federer Switzerland 1 5 Roddick USA 2 4

  4. Example using Oracle designer notations

  5. Converting Composite Attribute • only the simple component attributes of the composite attribute are included in the relation. CUSTOMER

  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 tableNote: Pre-requests requires more additional table

  15. Many to Many relationships

  16. Mapping Associative Entity to TablesWithout Identifier

  17. Mapping Associative Entity to Tables

  18. Mapping Associative Entity to TablesWith Identifier

  19. Mapping Associative Entity to TablesWith 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

More Related