Final Term Exam Spring 2020
Final Term Exam Spring 2020
Name Abubakar
ID 9616
Section D
Subject Database System (Theory)
Submitted To Ma’am Maryam Khan
Semester 4th
=====================================================================================
Q1: If there is one super type and three subtypes, then how many relations should be created?
Ans: If there is one super type and three subtypes, FOUR relations can be created.
=====================================================================================
Q2: Which of the following statements is/are false regarding subtype entities?
=====================================================================================
Q3: Answer the following question (I to II) by assuming the following scenario for table named as
INSTRUCTOR with attributes STUDENT, DEPARTMENT and PROFESSOR.
I) Considering the above scenario, which of the functional dependencies exist in INSTRUCTOR table?
i. Department Professor
ii. Student Professor
iii. Department Professor Student
iv. Professor Department
v. Professor Student
II) Choose the one which is not the candidate key of table INSTRUCTOR?
i) (Department, Student)
ii) (Department, Professor)
iii) (Department, Student, Professor)
iv) All of above
=====================================================================================
Q4: Consider the following Table 1 with the given scenario and answer the below question.
The scenario is: “A patient receives an appointment at a particular date and time with dentist doing a
specific surgery. On each day of patient appointments, a dentist is allocated to a specific surgery for that
day. “
ANSWER:
This table is not well structured, un-normalized containing redundant data. If we observe the above
table we will see the multiple values in appointment columns and which violates the INF, there are
many anomalies exist. We will discuss two anomalies which is given below:
1) INSERTION ANOMALIES:
If we insert a new patient record that makes and appointment with designated Doctor,
we would need to enter the correct data. If we insert the details for new patient in (patNo,
patName and Appointment) we would must enter the specific details of doctor. So, that the
patient details are compatible with values for the designated Doctor.
EXAMPLE:
S1011, To enter new patient data that doesn’t have Doctor to be assigned we can’t
insert NULL values for the primary key.
2) DELETION ANOMALIES:
If we want to delete a patient named Jill Bell so two records will be deleted from the
table i.e from row 2 and 5. This anomaly also obvious when we want to delete the dentistName,
multiple records need to deleted to maintain the data integrity. If we want to delete doctor
details his patients record will also be remove from the database.
=====================================================================================
Q5: Consider the following Table.
a) PARTIAL DEPENDENCIES:
Those non-key attributes which are fully functional dependent on primary key.
OR
REASON:
Partial dependency is that where an attribute in a table depends on only a part of the
primary key.
The column Teacher Subject is only row dependent on Teacher ID, where Teacher ID is
uniquely connected to Teacher Subject. Hence, there is no connection of Teacher Subject with Teacher
Age. Therefore, Partial Dependency occur in between Teacher ID and Teacher Subject.
------------------------------------------------------------------------------------------------------------------------------------------
As from the above table we know that non-prime attribute Teacher ID depends on
Teacher Age which is a proper subset of a candidate key, which violates the rules of 2NF.
To convert the table into 2NF, we break down the table into two parts.
Q6: The table shown in the below figure displays the information related to books, their categories and
prices.
ANSWER:
a) TRANSITIVE DEPENDENCY:
------------------------------------------------------------------------------------------------------------------------------------------
b) CONVERT THE TABLE INTO 3NF:
To convert the table into 3NF we will break down the table into two tables which is given below:
1) TABLE BOOK:
2) TABLE CATEGORY:
Category-ID Category-Type
1 Hobbies
2 Sports
1 Hobbies
3 History
2 Sports
=====================================================================================
Q7: Convert the following ER Diagram into Relational Model. (Ignore relationship attributes and derived
attributes while converting to Relational Model).
ANSWER:
ON NEXT PAGE
Company
Company-Id Company-Name
Staff
Foreign key
Task-Id Task-Description
Wife
Staff-Id Wife-Name
Phone
Foreign key
Perform
Foreign key
=====================================================================================