Database Design DBT1111C 5
Database Design DBT1111C 5
Database Design DBT1111C 5
Instructions to Candidates:
1. Attempt ALL questions.
2. Questions may be answered in any order but your answers must
show the question number clearly.
3. Always start a new question on a fresh page.
4. Total marks 100.
5. This question paper contains 4 questions and 7 pages including
this page.
Page 1 of 7
DATABASE DESIGN (DBT1111C) SITE/DEC 2018/2019 Sem 1 & 2018/ Sem 2
QUESTION 1 [14 Marks]
[2 marks]
[3 marks]
(c) The term integrity refers to the accuracy or correctness of the data in the database.
Define the following terms:
[2 x 3 marks]
(i) Tuple
[3 x 1 mark]
Page 2 of 7
DATABASE DESIGN (DBT1111C) SITE/DEC 2018/2019 Sem 1 & 2018/ Sem 2
QUESTION 2 [32 Marks]
AYURVEDIC HEALTH AND MASSAGE CENTER
The case study given below is about the AYURVEDIC HEALTH and MASSAGE CENTER
(AHMC).
The AHMC is managed by the Human Service Trust of Mauritius and provides a number
of health Services to its patients for examples: Sauna Bath, Body Massage, Acupuncture
and Acupressure among others. When a Patient comes at the center, he/she has to
register by providing his Last Name, First Name, Gender, Date of Birth, NIC, Address and
Mobile Number. Upon registration he is given a unique Patient_ID.
Once the Patient is registered in the system, an Appointment is created with a Physician.
The identifier for the Appointment is Appointment_ID and other attributes include
Appointment Date, Appointment Time and Appointment Status. A Patient can have many
Appointments but an Appointment is created for one Patient only. The identifier for a
Physician is Physician_ID and other attributes include: Last Name, First Name, Date of
Birth, NIC, Date Hired and Mobile Number. A Physician can attend many Appointments
but an Appointment is attended by one and only one Physician.
An appointment may generate a Prescription or may not generate any, but a Prescription
must be generated by one Appointment only. The identifier for Prescription is Prescription
ID and other attributes include is Prescription Date.
A Prescription must include one or many Medicines and a Medicine may be included in
many Prescription. Two attributes which are associated with the relationship is
Doze_Per_Day (how many to take per day) and Before_After_Meal (When to take the
medicine). The identifier for medicine is Medecine_ID and other attributes are
Medecine_Scientific_name and Medecine_Common_Name.
An Appointment may require many Sessions for a Service, but a Session is associated
with one and only one Appointment. The identifier for Session is Session_ID and other
attributes include: Session_Date and Session_TimeFrom.
A Service may be found in many Sessions, but a Session must be related to one Service
only. The identifier for Service is Service_ID and other attributes include: Service_Name,
Service_Price and Duration.
(a) Produce an Entity Relationship Diagram (Logical Data Structure) for the above
scenario. For each entity, identify the primary key attribute and label each relationship
with the appropriate role and cardinality.
[15 marks]
(b) Translate your ERD into a relational database schema.
[17 marks]
Page 3 of 7
DATABASE DESIGN (DBT1111C) SITE/DEC 2018/2019 Sem 1 & 2018/ Sem 2
QUESTION 3 [19 Marks]
(a) What is normalization?
[2 marks]
(b) Using the INVOICE Table structure given below, give an example of a
DELETION anomaly.
[2 marks]
(c) Using the INVOICE table structure shown below, write the relational schema,
draw its dependency diagram and identify all dependencies (including all partial,
transitive and fully functional dependencies).
[7 marks]
INVOICE TABLE
INV_NUM PROD_NUM SALE_DATE PROD_DESCRIPTION VEND_CODE VEND_NAME NUM_SOLD PROD_PRICE
(d) Using the answer from part (c) above, remove all partial dependencies, write the
relational schema, and draw the new dependency diagrams. Identify the normal forms
for each table structure you created.
[4 marks]
(e) Using the answer from part (d) above, remove all transitive dependencies, write
the relational schema and draw the new dependency diagrams. Also identify the
normal forms for each table structure you created.
[4 marks]
Page 4 of 7
DATABASE DESIGN (DBT1111C) SITE/DEC 2018/2019 Sem 1 & 2018/ Sem 2
QUESTION 4 [35 Marks]
This question refers to the database Schema given in Appendix.
(a) Draw an ERD for the Relational Schema given in the Appendix.
[3 marks]
(b) Write the SQL code that will create the Author table given in the appendix. Make
the Au_ID the primary key of the table.
[3 marks]
(c) Assuming that the Publisher table and the Book table has been created
successfully in the user schema, write SQL code to create the Book_Author
table and make the ISBN and AU_ID as the Foreign key constraint and also
make both the above columns to be a composite Primary key of the table.
[4 marks]
(d) Write SQL code to add a column called EMAIL in the Publisher table to store the
email address of the publisher.
[2 marks]
(e) Write SQL code to add a constraint on the email column so that no two publisher
will have the same email address.
[3 marks]
(f) Write the SQL code to delete the publisher whose name is HIGHTEXT PUBNS.
[2 marks]
(g) Write the SQL code to change the year born value from 1970 to 1971 for the
author whose AU_ID is 1.
[2 marks]
(h) Write SQL code to display the name of publishers who have not provided any
telephone number.
[2 marks]
(i) Write the SQL code required to list all book details whose title’s contains the
word “Information”.
[3 marks]
(j) Write SQL code to display the last name and first name of all authors who were
born in the year 1970.
[2 marks]
(k) Write the SQL code to display the last name and first name of all the authors
who have written the book with title “Structured C for Engineering and
Technology/Book and Diskette”
[5 marks]
(l) Write SQL code to display the ISBN and the title of all the book published by
Prentice Hall in 1988. [4 marks]
Page 5 of 7
DATABASE DESIGN (DBT1111C) SITE/DEC 2018/2019 Sem 1 & 2018/ Sem 2
APPENDIX
Author
Au_ID Au_Lname Au_Fname Year_Born
1 Jacobs Russell 1970
2 Metzger Phillip 1965
3 Boddie John 1964
4 Sydow Dan Parks 1980
6 Lloyd John 1985
8 Thiel James 1990
10 Ingham Kenneth 1970
12 Wellin Paul 1971
13 Kamin Sam 1984
Publisher
PubID Name Company Name Street City State Zip Telephone
2 PRENTICE HALL PRENTICE HALL 15 Columbus Cir. New York NY 10023 800-922-0579
10 JOHN WILEY & SONS JOHN WILEY & SONS 605 Third Ave New York NY 10158 212-850-6000
Book
Year
ISBN Title PubID
Published
0-0038307-6-4 dBASE III : A Practical Guide 1989 10
0-0038326-7-8 The dBASE Programming Language 1988 2
0-0038337-8-X dBASE III Plus 1995 2
Database Management : Developing Application Systems Using
0-0131985-2-1 1989 1
Oracle
0-0133656-1-4 Wordstar 4.0-6.0 Quick Reference Guide 1990 3
0-0134436-3-1 Oracle Triggers and Stored Procedure Programming 1996 4
0-0201145-8-3 Programming in Clipper 1988 4
0-0201406-7-3 Inside MacIntosh 1994 8
0-0207992-0-9 Omni Online Database Directory 1983 9
0-0230081-2-1 Structured C for Engineering and Technology/Book and Diskette 1995 5
An Introduction to Assembly Language Programming for the Intel
0-0230362-0-6 1995 7
8088 Microprocessor
Applied Calculus With Linear Programming : For Business,
0-0230650-8-7 Economics, Life Sciences, and Social Sciences (College 1995 7
Mathematics Series
Page 6 of 7
DATABASE DESIGN (DBT1111C) SITE/DEC 2018/2019 Sem 1 & 2018/ Sem 2
Book_Author
ISBN Au_ID
0-0038307-6-4 1
0-0038326-7-8 1
0-0038337-8-X 3
0-0131985-2-1 12
0-0131985-2-1 10
0-0133656-1-4 2
0-0134436-3-1 10
0-0134436-3-1 12
0-0230081-2-1 12
0-0230081-2-1 1
0-0230081-2-1 10
0-0230362-0-6 2
0-0230362-0-6 3
0-0230650-8-7 10
Page 7 of 7
DATABASE DESIGN (DBT1111C) SITE/DEC 2018/2019 Sem 1 & 2018/ Sem 2