Fall 2023 - CS403P - 2 - SOL
Fall 2023 - CS403P - 2 - SOL
Assignment No.2
(Graded)
Maximum Marks: 20
Instructions
The purpose of this assignment is to give your hands-on practice. It is expected that
students will solve the assignment themselves. The following rules will apply during the
evaluation of the assignment.
You can insert normalized tables directly in inline assignment interface as shown below (see
table creation part by zooming the image).
Objective & Learning Outcome
The objective of this assignment is to:
● implement Normalization.
After completing the assignment, the student will be able to normalize tables in second and
third normal form.
Scenario:
Suppose ABC university has its campuses in different cities. Consider university is storing data
of different study programs, students and campuses in the form of Table 1 in a database. A
student can only enroll in any 6-months certificate course along with any current degree
program.
Table 1:
Study Duration Semester Student_CNIC Name Campus Campus Semester
Program Code City GPA
Covering Labs:
Assignment 2 covers contents of Lab 8 & 9.
Solution:
Functional Dependencies:
StudyProgram, Semester, Student_CNIC-> Name, Duration, CampusID, CampusCity, SemesterGPA
StudyProgram->Duration
StudentCNIC->Name,CampusID,CampusCity
CampusID->CampusCity
Partial Dependency:
StudyProgram, Semester, Student_CNIC-> Name, Duration, CampusID, CampusCity, SemesterGPA
Duartion is partially dependent on StudyProgarm which is part of key.
Name, CampusID, and CampusCity are also partially dependent on Student_CNIC
First, we will convert given table in second normal form by removing Partial Dependency.
Table:Study_Program
Study Program Duration
MCS 2 Years
BS 4 Years
MS 3 Years
Table: Student_Detail
Student_CNIC Name CampusCode Campus City
Transitive Dependency:
In Student_Detail table, one non-key attribute CampusID is determining another non-key
attribute CampusCity. So, here transitive dependency exists.
Student_CNIC->Name,CampusID,CampusCity
CampusID->CampusCity
Now, we will convert given tables in third normal form by removing Transitive Dependency.
Table: Campus
CampusCode Campus City
ATK001 Attock
RWP02 Rawalpindi
ISB03 Islamabad
LHR01 Lahore
Table: Student_Detail
Student_CNIC Name CampusCode
MCS 2 Years
BS 4 Years
MS 3 Years
Table: Campus
CampusCode Campus City
ATK001 Attock
RWP02 Rawalpindi
ISB03 Islamabad
LHR01 Lahore
Table: Student_Detail
Student_CNIC Name CampusCode
Table: Progarm_Semester_Students