0
4.1kviews
Explain the steps of an algorithm for ER to relational mapping
1 Answer
0
70views

• ER Model when conceptualized into diagrams gives a good overview of entity-relationship, which is easier to understand.

• ER diagrams can be mapped to Relational schema using step by step procedure.

• Though all the ER constraints cannot be imported into Relational model but an approximate schema can be generated.

ER Diagrams mainly comprised of:

• Entity and its attributes

• Relationship which is association among entities

Mapping Entity

An entity is a real world object with some attributes.

enter image description here

• Create table for each entity

• Entity's attributes should become fields of tables with their respective data types.

• Declare primary key

Mapping relationship

A relationship is association among entities.

enter image description here

• Create table for a relationship

• Add the primary keys of all participating Entities as fields of table with their respective data types.

• If relationship has any attribute, add each attribute as field of table.

• Declare a primary key composing all the primary keys of participating entities.

• Declare all foreign key constraints.

Mapping Weak Entity Sets

A weak entity sets is one which does not have any primary key associated with it.

enter image description here

• Create table for weak entity set

• Add all its attributes to table as field

• Add the primary key of identifying entity set

• Declare all foreign key constraints

Mapping hierarchical entities

ER specialization or generalization comes in the form of hierarchical entity sets.

enter image description here

• Create tables for all higher level entities

• Create tables for lower level entities

• Add primary keys of higher level entities in the table of lower level entities

• In lower level tables, add all other attributes of lower entities.

• Declare primary key of higher level table the primary key for lower level table

Please log in to add an answer.