You are on page 1of 23

Reduction of an E-R Schema to Tables

(CLASS-L11)

Presented By:
Monalisa Panigrahi
Asst.Professor (LPU)
B2702-CSE 301

10/5/2009 1
Reduction of an E-R Schema
to Tables
„ Primary keys allow entity sets and relationship
sets to be expressed uniformly as tables which
represent the contents of the database.
„ A database which conforms to an E-R diagram
can be represented by a collection of 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.
„ Converting an E-R diagram to a table format is
the basis for deriving a relational database
design from an E-R diagram.
10/5/2009 2
Conversion of Strong Entities

„ For each strong entity in E-R


diagram, create a separate table
with the same name. Include all
simple attributes of the strong
entity with the same name.

„ Create a key for the table

10/5/2009 3
Example

10/5/2009 4
Conversion of Strong
Entity(Customer)

10/5/2009 5
Conversion of Weak Entities

„ A weak entity set becomes a


table that includes a column for
the primary key of the identifying
strong entity set, along with its
own attributes

10/5/2009 6
Example

10/5/2009 7
Conversion of Weak
Entity(payment)

10/5/2009 8
Conversion of Relationship
sets

10/5/2009 9
Conversion of one-one
Relationship
„ For each one-one relationship,(betn
A and B),modify one of the table
(A or B),to include the P.Key of
other relation as F.Key
„ If relationship has attributes,it must
be transferred to the modified
relation
„ If any relation has a total
participation, only that table must
10/5/2009 10
be modifed
Conversion of one-many
Relationship
„ For each one-Many relationship,
modify N-side relation to hold the
primary key of other as a foreign
key

10/5/2009 11
Conversion of many-many
Relationship
„ A many-to-many relationship set is
represented as a table with columns
for the primary keys of the two
participating entity sets, and any
descriptive attributes of the
relationship set.

10/5/2009 12
Example

10/5/2009 13
EX: Table for relationship set
borrower

10/5/2009 14
Conversion of Multivalued
Attributes
„ For each Multivalued attribute,
create a separate table and include
primary key of the strong entity as
a foreign key

10/5/2009 15
Representing Specialization
as Tables –

10/5/2009 16
Method 1:
„ Form a table for the higher level entity (
Person)
„ Form a table for each lower level entity set,
include primary key of higher level entity set
and local attributes
„
Tables Attributes
Person name, street, city
Customer name, credit-rating

Employee +name, salary

Drawback: getting information


10/5/2009 about, e.g., employee requires 17

accessing two tables


Method 2:
„ Form a table for each entity set with all local
and inherited attributes
Tables Attributes

Person name, street, city


Customer name, street, city, credit-
rating
Employee
name, street, city,
salary

Drawback: street and city


may be stored redundantly
for persons who are both
10/5/2009
customers and employees 18
Representing Aggregation as
Tables
„ To represent aggregation, create a
table containing
z primary key of the aggregated
relationship,
z the primary key of the associated
entity set
z Any descriptive attributes

10/5/2009 19
Example:
„ To represent aggregation manages between
relationship works-on and entity set manager,
create a table
„ manages(employee-id, branch-name, title,
manager-name)

10/5/2009 20
Advantages Of E-R model

1. Conceptual Simplicity
2. Maps well to the relational model
3. Simple and easy to understand
4. It is acting as a effective
communication tool between user
and developer

10/5/2009 21
Disadvantages Of E-R model

1. Limited Constraint representation


2. Limited Relationship
representation
3. Loss of Information content
4. Suitable only for big projects

10/5/2009 22
10/5/2009 23

You might also like