You are on page 1of 4

Final Exam (Take-Home) Spring - 2020

Subject: Database Management Systems Submission Day: Wednesday


Instructor: Rukhsana Majeed Submission Date & Time: 10/06/2020, 12:00
Program: BS (CS/SE) Max. Marks: 40

Faculty of engineering, sciences and technology

Please follow the instructions carefully:


1. Write you answers in a Word file and upload the file before the due date on VLE.
2. Name your Word file in the following format:
(StudentID_Student’sName_CourseName_Instructor’sName_ Spring2020)
3. Use 12 pt. font size and Times New Roman font style along with 1-inch page
margins.
4. Follow the requirements of the word limit and the marking criteria while writing
your answers.
5. Provide relevant, original and conceptual answers, as this exam aims to test your
ability to examine, explain, modify or develop concepts discussed during the
course.
6. Do not copy answers from the internet or other sources. The plagiarism of your
answers will be checked through Turnitin software.
7. Recheck your answers before the submission on VLE to correct any content or
language related errors.

Page 1 of 4
Question no 01: [06 Marks]
Answer the following.
i) Is it possible that during the physical database design and creation step of
database development you might want to return to the logical database design
activity? Why or why not? If it is possible, give an example of what might arise
during physical database design and creation that would cause you to want to
reconsider the conceptual and external database designs from prior steps.
ii) Composite keys are useful to represent M:N relationships and weak (strong
identifying) entities. Justify this term with some real world example.
iii) Our database have the advantage of security so why we give permissions to user
using grant in database. Explain your answer.

Question no 02: [25 Marks]

a) Draw an Extended Entity Relationship diagram for the following scenario. Show
complete relationships between entities having attributes. Also show multiplicity and
specify the key and participation constraints for each relationship set. (8 Marks)

A Karachi based Computer Institute offers different diploma programs. A student


can complete a diploma program by taking the set of prescribed courses in the
defined sequence. The institute has instructors, administrative staff, and other
supporting staff like office boy etc. An instructor can teach courses in one or more
programs. The institute is interested in developing a database system for effective
and efficient student data management.
Some of the requirements are that at the end of each semester, a transcript
showing the student progress in the program need to be printed. Every student is
given an account and password; using which the student should be able to access
his academic record by accessing the Web site of the institute. All the data should
be properly secured. Only the authorized users should be allowed to make
changes to the data.
Some of the business rules of the institute are:
1) When a student is admitted to the program, he is assigned a unique student
number. The student number is the most commonly used attribute to access or
modify the student record for example name, date of birth and grades etc. For
Student we keep data like first name, last name, date of birth, Mobile No, phone
no, NIC, Father Name, Father Occupation, address, certificates/degrees
2) During the registration, proper checks need to be enforced to ensure minimum
and maximum load limits, which are 9 and 16. Also prerequisite/co requisite
requirements should never be violated.
3) The instructors teach courses. One course can be taught by many instructors.
Course’s data include course code, name and prerequisite etc. Obviously no two
instructors can teach courses at the same time and same room, and no instructor
can teach courses at the same time. For Instructors we record first name, last
name, date of birth, mobile no, phone no, address, qualification, work experience
and salary etc.

Page 2 of 4
b) Identify the problems in the above ERD and walk through the steps of normalizing our
data model to the third normal form (3NF) to eliminate redundancies. (5 marks)
c) Implement the above ERD scenario using Data Definition Language. (10 marks)
d) Write down the DML statement for the following queries. (2 Marks)
i) Write a query to insert the details of three instructor into the Instructor table
ii) Write a query to insert the details of prerequisite for each of the Course.

Question no 03: [04 Marks]

Write SQL statement to answer following queries using northwind schema.

1. Find out how many times ‘Chai’ product has been ordered?
2. Make a complete list of customers, the OrderID and date of any orders they have
made. Include customers who have not placed any orders.
3. Create a parameterized query that has the user enter a city and then list the
customers or suppliers from that city.
4. Make a list of products and the number of orders in which the product appears.
Put the most frequently ordered item at the top of the list and so on to the least
frequently ordered item.

Question no 04: [05 Marks]

Following are few tables given from the database of Online Shopping System.

Employee:
EmployeeID Name Title TitleOfCourtesy Salary
1 Nancy Sales Representative Ms. 29540
2 Andrew Vice President, Sales Dr. 22540
3 Janet Sales Representative Ms. 31190
4 Margaret Sales Representative Mrs. 18610
5 Steven Sales Manager Mr. 17440
Customer:
CustomerID Name City
ALFKI Maria Anders Berlin
ANATR Ana Trujillo Mxico D.F.
ANTON Antonio Moreno Mxico D.F.
AROUT Thomas Hardy London
BERGS Christina Berglund Lule
Order:
OrderID CustomerID EmployeeID ProductID OrderDate ShipName
10248 ALFKI 1 3 7/4/1996 Ernst Handel
10249 ANTON 2 2 7/5/1996 Toms Spezialitten
10250 ANATR 2 2 7/8/1996 Hanari Carnes
10251 AROUT 4 1 12/1/1996 Suprmes dlices
10252 AROUT 3 5 9/2/1996 Hanari Carnes

Page 3 of 4
Product:
ProductID ProductName Quantity Price
1 Chai 10 boxes 20 bags 180
2 Chang 24 - 12 oz bottles 192
3 Aniseed Syrup 12 - 550 ml bottles 107
4 Ikura 12 - 200 ml jars 310
5 Queso Cabrales 1 kg pkg. 210

a) Write relational algebra statements for following queries.


i. List of all products items along with quantity available in the system.
ii. Find the name of Customers who ordered ‘Chang’ product.
iii. List all ProductID where there is a product exist but not ordered by any
customer.
iv. Find the EmployeeID of employees who deal exactly two orders.
v. Identify all customers who have ordered two products.

Page 4 of 4

You might also like