CS403P – Database Management System(Practical)
Assignment No.2
(Graded)
Maximum Marks: 20
Due Date: 15th Jan 2024
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.
● Cheating from any source will result in zero marks
in the assignment.
● The submitted assignment does NOT open or file is corrupted.
● No assignment after the due date will be accepted
● Student can submit HTML, Images & Plain text only in this inline Mode. You
may also insert image file/table.
● DOC/pdf File uploading option will not be available) in inline assignment
submission.
Uploading Assignment Instruction
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.
Note: Table 1 has composite primary key: StudyProgram, Semester, Student_CNIC
Table 1:
Study Duration Semester Student_CNIC Name Campus Campus Semester
Program Code City GPA
MCS 2 Years Fall2018 37405-111 Ali Ahmad ATK001 Attock 3.50
MCS 2 Years Spring2018 37405-111 Ali Ahmad ATK001 Attock 3.75
MCS 2 Years Fall2023 37405-018 Nimra Khan RWP02 Rawalpindi 3.20
Certificate 6 months Fall2023 37405-018 Nimra Khan RWP02 Rawalpindi 3.80
Course
(English)
MCS 2 Years Fall2023 37405-105 Sehrish RWP02 Rawalpindi 3.85
Iqbal
MCS 2 Years Spring2023 37405-128 Ahmed ISB03 Islamabad 3.50
Sarwar
Certificate 6 months Spring2018 37405-111 Ali Ahmad ATK001 Attock 3.90
Course (IT)
MS 3 Years Fall2023 37405-111 Ali Ahmad ATK001 Attock 3.5
MS 3 Years Spring2023 37405-111 Ali Ahmad ATK001 Attock 3.9
BS 4 Years Spring2023 37405-100 Akmal LHR01 Lahore 3.2
Naeem
Question No. 1 (20 Marks)
The given table is in un-normalized form. You are required to carefully analyze the Table 1
and convert up to third normal form. You have to do the following.
● Identify all functional dependencies.
● Your solution should clearly show partial and transitive dependency.
● Provide all normalized tables till third normal form.
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
Certificate Course (English) 6 months
Certificate Course (IT) 6 months
Table: Student_Detail
Student_CNIC Name CampusCode Campus City
37405-111 Ali Ahmad ATK001 Attock
37405-018 Nimra Khan RWP02 Rawalpindi
37405-105 Sehrish Iqbal RWP02 Rawalpindi
37405-128 Ahmed Sarwar ISB03 Islamabad
37405-100 Akmal Naeem LHR01 Lahore
Table: Progarm_Semester_Students
Study Program Semester Student_CNIC SemesterGPA
MCS Fall2018 37405-111 3.50
MCS Spring2018 37405-111 3.75
MCS Fall2023 37405-018 3.20
MCS Fall2023 37405-105 3.85
MCS Spring2023 37405-128 3.50
MS Fall2023 37405-111 3.5
MS Spring2023 37405-111 3.9
BS Spring2023 37405-100 3.2
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
37405-111 Ali Ahmad ATK001
37405-018 Nimra Khan RWP02
37405-105 Sehrish Iqbal RWP02
37405-128 Ahmed Sarwar ISB03
37405-100 Akmal Naeem LHR01
All Normalized Tables up to Third Normal Form:
Table:Study_Program
Study Program Duration
MCS 2 Years
BS 4 Years
MS 3 Years
Certificate Course (English) 6 months
Certificate Course (IT) 6 months
Table: Campus
CampusCode Campus City
ATK001 Attock
RWP02 Rawalpindi
ISB03 Islamabad
LHR01 Lahore
Table: Student_Detail
Student_CNIC Name CampusCode
37405-111 Ali Ahmad ATK001
37405-018 Nimra Khan RWP02
37405-105 Sehrish Iqbal RWP02
37405-128 Ahmed Sarwar ISB03
37405-100 Akmal Naeem LHR01
Table: Progarm_Semester_Students
Study Semester Student_CNIC SemesterGPA
Program
MCS Fall2018 37405-111 3.50
MCS Spring2018 37405-111 3.75
MCS Fall2023 37405-018 3.20
MCS Fall2023 37405-105 3.85
MCS Spring2023 37405-128 3.50
MS Fall2023 37405-111 3.5
MS Spring2023 37405-111 3.9
BS Spring2023 37405-100 3.2