Conversion of E-R Diagram To Tables
Conversion of E-R Diagram To Tables
Tables
• For each entity set and relationship set
there is a unique table, which is assigned
the name of the corresponding entity set
or relationship set. Each table has a
number of columns (generally
corresponding to attributes), which have
unique names. Primary keys allow entity
sets and relationship sets to be expressed
uniformly as tables, which represent the
contents of the database.
Representing Entity sets as
Tables
Composite and Multi-Value
Attributes
• In order to convert an entity having
composite attributes, the composite
attributes are flattened out by creating a
separate attribute for each component
attribute.
Representing Generalization as
Tables
• There are two approaches to convert an E-R diagram
representing generalization.
• Method 1
• E-R diagram containing generalization as shown in figure
4.20 can be converted in following tables:
• Account: Account_Number, Balance
• Saving_Account: Account_Number, Interest_rate
• Checking _Account: Account_Number,
Overdraft_Amount
• The problem of this approach is that in order to obtain
Balance we have to join two tables.
• Method 2
• In second method we create only two
tables as shown below:
• Saving_Account: Account_Number,
Balance, Interest_rate
• Checking _Account: Account_Number,
Balance, Overdraft_Amount
• The problem of this is the redundancy of
Balance field.