Professional Documents
Culture Documents
Lec 6 - IDB
Lec 6 - IDB
Lec 6 - IDB
Introduction to
Database Systems
Mohammad Imran
Lecturer
Department of Information Technology
Balochistan University of Information Technology, Engineering & Management Sciences
Lecture 6
Mapping ERD to
Relational Model
So far…
• We have seen different modeling techniques to model the
database
• How to implement these models in original database
design?
Convert ER Model to
Relational Model
• The process is called mapping of ER model to relational
model
• Apparently Converting ERD to Relational Database Design
Review - Concepts
Relational Model is made up of tables
Review - Example
Attribute
Cardinality = 2
tuple/relational
instance SID Name Major GPA
1234 Bilal CS 2.8
5678 Ali EE 3.6
4 Degree
A Schema / Relation
Introduction to Database Systems Spring 2015 Mohammad Imran May 4, 2015 6
Balochistan University of Information Technology, Engineering & Management Sciences
Major Dept
GPA
Database
Relational Physical
Model
Schema Storage
(E/R)
Relational Model
Products:
Name Price Category Manufacturer
Concepts Cleared?
• So we had a review of previous concepts related to ERD
• Lets move on and see how to convert an EDR to
relational Model
Mapping Process
Lets get started
Entities Mapping
• An entity set within ER diagram is turned into a table
• You may preferably keep the same name for the entity or
give it a sensible name
• But avoid DBMS reserved words as well as avoid the use
of special characters
Attributes Mapping
• Each attribute turns into a column (attribute) in the table
• The key attribute of the entity is the primary key of the
table which is usually underlined
• It can be composite if required but can never be null
Major Dept
GPA
Deptt: Address
Mapping Relationships
to ER Model
Attribute 1
EntBID
EntAID Attribute 1
1 1
Entity A Relates to Entity B
Attribute 2
*Bold and italics are Foreign Keys, underlined are Primary Keys
Thank you
37
Introduction to Database Systems Spring 2015 Mohammad Imran May 4, 2015