Module 2 - DBMS - 1ST INTERNAL - Converting ER To Table
Module 2 - DBMS - 1ST INTERNAL - Converting ER To Table
Module 2 - DBMS - 1ST INTERNAL - Converting ER To Table
ER/CORP/CRS/DB92 Ver. No.: 0.1 Confidential Copyright © 2008, Infosys Technologies Ltd.
Converting Strong entity types
The key attribute of the entity type becomes the primary key of the
table
And
Emp_Skillset( E#, Skillset)
The primary key of the partial participant will become the foreign key
in the total participant.
Employee (EmpCode,EmpName,DateOfJoining)
(OR)
Employee (EmpCode,EmpName,DateOfJoining,Sits_on)
1 N
Teacher Teaches Subject
The primary key of the relation on the “1” side of the relationship
becomes a foreign key in the relation on the “N” side.
M N
Student Enrolls Course
The primary key of the new table is the combination of the two foreign
keys.
Student (StudentID,SName,DOB,Address) Course(CourseID,CName)
M Guarantor_of
N
Employee
There will be two resulting tables. One to represent the entity and
another to represent the M:N relationship as follows
There are four strong entities in the ER Diagram of Online Retail Application.
Customer
Item
Bill
Supplier
Item(ItemId,ItemName,QtyOnHand,UnitPrice,UnitOfMeasurement,ReOrderLevel,ReOr
derQty,Discount)
SupplierId is
ItemSupplier(ItemId, SupplierId) multi valued
in Item entity
16 Confidential
Copyright © 2008, Infosys Technologies Ltd.
Deriving Logical Schema for Online Retail
Application
Supplier(SupplierId, SupplierName,SupplierContactNo)
ItemOrdered(ItemId,SupplierId,QtyOrdered,DeliveryStatus,OrderDate,
DeliveryDate) OrderedTo
relationship
is M:N so
new relation
is required
SupplierId is Primary key of Supplier Relation
(ItemId,SupplierId) is composite primary key of ItemOrdered relation
ItemId of ItemOrdered relation is foreign key to Item relation
SupplierId of ItemOrdered relation is foreign key to Supplier relation
Purchase relationship is
ternary so new relation is
required.
18 Confidential
Copyright © 2008, Infosys Technologies Ltd.