0% found this document useful (0 votes)
38 views5 pages

Department of Computer Science Bahria University, Islamabad

This lab focuses on converting an entity relationship (ER) model to a relational model using a 9-step algorithm. The algorithm maps entity types, relationships, attributes and other concepts from the ER model to tables and columns in a relational database. As an example, an ER model of a company is converted to relations for the Company, Staff, Child, Spouse and Phone entities and their relationships. Students are asked to convert an ER model of the US Congress to relations and provide the data definition language to define the tables and relationships.

Uploaded by

Javeria Abbasi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views5 pages

Department of Computer Science Bahria University, Islamabad

This lab focuses on converting an entity relationship (ER) model to a relational model using a 9-step algorithm. The algorithm maps entity types, relationships, attributes and other concepts from the ER model to tables and columns in a relational database. As an example, an ER model of a company is converted to relations for the Company, Staff, Child, Spouse and Phone entities and their relationships. Students are asked to convert an ER model of the US Congress to relations and provide the data definition language to define the tables and relationships.

Uploaded by

Javeria Abbasi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

1

Department of Computer Science


Bahria University, Islamabad

Fall 2020
BS-IT-4AB

Course Code : CSL-220


Database Management Systems

Lab Manual 11

Student Name: ____JAVERIA ABBASI_______________

Enrollment Number: _01-235191-014_________


2

Lab # 11
• Conversion from Entity Relationship Model to a Relational Model
___________________________________________________________________________
______________

This lab will focus on the process of converting a conceptual design in the form of an
ERD to a relational design i.e. schema. The process is carried out using a 9 step
algorithm, which specifies the conversion.

The 9 step algorithm of mapping conceptual to relational schema includes 7 steps for
mapping ER model to relations and the additional two steps are used to map the
additional concepts i.e. the EER to relational design. Various steps of the algorithm
include:
▪ Step 1: Mapping of Regular Entity Types
▪ Step 2: Mapping of Weak Entity Types
▪ Step 3: Mapping of Binary 1:1 Relationship Types
▪ Step 4: Mapping of Binary 1:N Relationship Types
▪ Step 5: Mapping of Binary M:N Relationship Types
▪ Step 6: Mapping of Multivalued Attributes
▪ Step 7: Mapping of N-ary Relationship Types
▪ Step 8: Options for Mapping Specialization or Generalization
▪ Step 9: Mapping of Union Types

Example
Carefully study the following ER Model before moving to the next page
3

Above figure can be represented as a Relational Model using following relations.

Company (CompanyID, name, address)


Staff (StaffID, dob, name, address, since, CompanyID)
Child (ChildID, name, StaffID )
Spouse (SpouseID, name, StaffID)
Phone (PhoneID, phoneNumber, StaffID)
Task (TaskID, description)
Perform (PerformID, StaffID, TaskID )
* Refer to lecture slides and book for details on each step of the algorithm.
* Refer to previous labs for Data Definition Language (DDL) syntax.

Lab Tasks
1. Convert ERD for US Congressperson into a relational model. Show relational
model as well as give DDL commands
4

CONGRESSPERSON:
NAME DISTRICT PARTY START_DATE

STATE:
name REGION NAME

BILL:
BILL_NAME PASSED_FAILED DATE_OF_VOTE

SPONSORED:
NAME BILL_NAME

VOTED:
HOW NAME BILL_NAME

Additional Practice:

Convert the ER Model of your project into Relational Model.

create table CONGRESSPERSON


(
Name varchar(50),
District varchar (50),
Party varchar (50),
Start_Date varchar (20)
);
alter table CONGRESSPERSON add constraint primary primary key (Name);

create table state


(
5

State_Name varchar (50),


region varchar (50),
name varchar (64),
foreign key (Name) references CONGRESSPERSON(name)
);

create table Bill


(
bill_name varchar (50),
passed_failed varchar (20),
date_of_vote varchar (20)
);
alter table bill add primary key(bill_name);

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy