Guidelines for the examination of Database systems

Guidelines for the examination of Database systems
Rules:
•
•
•
Questions will be in English, but your answers can be either in English or in German
You are allowed to have with you the following:
o Slides of the course (printed or electronically)
o Books (whichever)
o Personal notes (handwritten or electronically)
o Your computer device
o Internet connection
It is strictly not allowed to talk between you in any form (including communication via Internet)
Content:
The examination questions will be of the following form:
•
One question about developing an ER diagram
o For example: “Construct an E-R diagram for a hospital with a set of patients and a set of
medical doctors. Associate with each patient a log of the various tests and examinations
conducted.”
o Possible answer: ER diagram is given in the following figure.
o
Please provide a clear diagram; it is better that you first make a separate sketch (paper
will be provided for this purpose) and after its finalization, you can write the final ER
diagram (the sketch will not be graded). Don’t forget to have 2-3 attributes for each
entity, to identify the primary key, to denote the cardinality constraints in the
relationships, and to explain your solution (e.g., why you chose a relationship to be
many-to-one) in a paragraph of 4-5 lines (but not more).
•
Two questions about constructing SQL queries
o For example: “Write the following query in SQL, using the university schema:
For each department, find the maximum salary of instructors in that department. You
may assume that every department has at least one instructor.”
Solution:
select dept, max(salary)
from instructor
group by dept;
o
•
During the examination, you are not expected to test the SQL queries by running them
in a database system. Therefore, possible small syntactical errors (e.g., you may forget a
parenthesis) will not cause major reduction in your grade. Important is to have a correct
logic in your SQL queries.
Two multiple choice questions on the topics of: (i) transformation of ER-diagram to tables, (ii)
database design (2-NF, 3-NF), (iii) database updating, and (iv) referential integrity constraints.
o For example: “Consider the following part of an ER diagram (see figure). Which of the
following sentences is correct with respect to the transformation of the ER diagram to
table(s)?”
a) We have to create one table with the schema:
advisor(instructorID, instructorName, salary, studentID, studentName, tot_cred).
b) We have to create the tables with the schema:
instructor(ID, name, salary)
student(ID, name, tot_cred)
advisor(instructorID, studentID)
c) We have to create two tables with the schema:
instructor(ID, name, salary)
student(ID, name, tot_cred, advisorID)
d) We have to create two tables with the schema:
instructor(ID, name, salary)
student(ID, name, tot_cred, advisorID)
Answer: d)
If you want to check why d) is correct, read about the rules of transforming ER diagrams
to tables and consider that the given diagram represents a 1-1 relationship. In this case,
the ID of one of the tables becomes an attribute in the other table. In answer d) this is
the advisorID in the student table. Answer c) is not correct, because advisorID is denoted
(it is underlined) as part of the primary key in table student, which is not correct, because
advisorID will be foreign key to table instructor and not part of the primary key of table
student.
(Please note that the explanation for the correct answer is given here only to help you
and will not be required in the examination for multiple choice questions.)
You are welcome anytime for discussing your questions (just send an email to
alexandros.nanopoulos(at)ku.de to fix an appointment).
Alexandros Nanopoulos