18
Conversion of E-R Diagram to Tables

4 ER to Tables

  • Upload
    eumine

  • View
    113

  • Download
    2

Embed Size (px)

DESCRIPTION

DBMS SLIDES

Citation preview

Page 1: 4 ER to Tables

Conversion of E-R Diagram to Tables

Page 2: 4 ER to 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.

Page 3: 4 ER to Tables

Representing Entity sets as Tables

Page 4: 4 ER to 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.

Page 5: 4 ER to Tables
Page 6: 4 ER to Tables
Page 7: 4 ER to Tables
Page 8: 4 ER to Tables
Page 9: 4 ER to Tables
Page 10: 4 ER to Tables
Page 11: 4 ER to Tables
Page 12: 4 ER to Tables
Page 13: 4 ER to Tables

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.

Page 14: 4 ER to Tables
Page 15: 4 ER to 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.

Page 16: 4 ER to Tables
Page 17: 4 ER to Tables
Page 18: 4 ER to Tables