Beruflich Dokumente
Kultur Dokumente
Instru
tions
This is the midterm exam from the Spring 1999 edition of the
ourse.
There were 2 hours, 50 minutes time for solving the exer
ises.
Note that the midterm exam in this
ourse will in
lude some new types of exer
ises.
I will give some hints during the last le
ture before the exam and on the web page.
There may be some multiple
hoi
e exer
ises.
Examples of new types of exer
ises are, e.g.:
{ Find errors in relational algebra queries.
{ Given pairs of relational algebra queries, whi
h ones are equivalent?
{ Given pairs of ER-s
hemas, whi
h ones are equivalent.
{ Given fun
tional dependen
ies, determine a key.
However, it will
ertainly be a good preparation to do these example exer
ises under
exam-like
onditions. Do it relatively early so that you still have time to pra
ti
e
more or ask questions if you nd this exam diÆ
ult.
In the real midterm exam, spa
e for the solutions will be provided.
You may use books and notes in the exam. But don't forget that the time is limited.
Books will only help if you know exa
tly where to sear
h (i.e. just must have read
them before). It might be helpful to make your own summary notes when you repeat
the material for the exam.
If you do not understand the exer
ises, please ask (also during the real exam).
The midterm exam will be on February 23. Please
he
k the web page for any
hanges.
Please design an ER-S
hema for a very simplied database of a physi
ian (do
tor). The
physi
ian wants to store data about:
INFSCI 2710 \Database Management" | Midterm Exam (Spring 1999) 2
You are given the following ER-S
hema for a simplied airline database. It
ontains
information about:
Airports: The airport id (e.g. PIT, JFK) and the name of the
ity.
Flight Routes: The number of the
ight (e.g. \US 781"), the airport from whi
h the
ight starts and the goal airport (e.g. from Frankfurt to Pittsburgh), and the planned
departure and arrival times (e.g. 11:35 and 14:45). For simpli
ity, intermediate stops
are not represented.
Flight Instan
es: A
ight s
heduled for a parti
ular date, e.g.
ight \US 781" on
February 25. Also the en
onomy
lass pri
e for this
ight instan
e is stored (it
depends on the date).
Employees: Their so
ial se
urity number and name.
Crew Assignments: Whi
h employee is s
heduled to work on whi
h
ight instan
e?
For simpli
ity, dierent types of employees (e.g. pilots and stewards) are not repre-
sented.
INFSCI 2710 \Database Management" | Midterm Exam (Spring 1999) 3
Departure
(1; 1) from PP (0; )
P PP ID
HHH
No Flight
Airport
P PP
(0; ) (1 1)
;
PP
to
(0 ) ; City
has Arrival
H
Date
HH (1; 1)
Instan
e
(0; )
Crew
(0; )
Employee
HHH
SSN
Pri
e
Name
Translate this s
hema into the relational model. Spe
ify keys, foreign keys, and not null
onstraints. If further
onstraints are needed to make the relational s
hema equivalent to
the ER-s
hema, please explain them in natural language.
Please explain one additional
onstraint for the
ights database whi
h ex
ludes impossible
database states. You do not have to spe
ify the
onstraint formally. Only explain a
situation whi
h the ER-s
hema allows, but whi
h
annot happen in the real world.
INFSCI 2710 \Database Management" | Midterm Exam (Spring 1999) 4
Supplement
Name Produ
er
Centrum Lederle
One A Day Bayer
.. ..
. .
Vitamin(Substan
e: string, Daily Value: number not null, Unit: String not null)
/* Despite the name, this relation also
ontains minerals et
. */
Vitamin
Substan
e Daily Value Unit
Vitamin A 5000 IU
Vitamin C 60 mg
Biotin 300 m
g
Iron 18 mg
.. .. ..
. . .
Contents(Name ! Supplement, Substan
e ! Vitamin, Quantity: number not null)
/* Quantity is the
ontents in one tablet, same units as in table \Vitamin" */
Contents
Name Substan
e Quantity
Centrum Vitamin A 5000
One A Day Vitamin A 5000
Centrum Vitamin C 60
One A Day Vitamin C 60
Centrum Biotin 30
Centrum Iron 18
One A Day Iron 27
.. .. ..
. . .
All attributes are not null. Sin
e the \not null"
onstraint is implied by the primary key
onstraint, it is expli
itly listed only for the non-key attributes.
Of
ourse, the database state is only an example. Your queries must work with any
database state.
INFSCI 2710 \Database Management" | Midterm Exam (Spring 1999) 5
Please formulate also the following queries to the multivitamin tables database in rela-
tional algebra:
a) Whi
h nutrition supplements (the name suÆ
es) do not
ontain \Biotin".
b) Whi
h nutrition supplements
ontain \Vitamin C", but no other Substan
es? So you
have to sele
t only the pure Vitamin C tablets. Print name and produ
er. You
an
assume that all tablets
ontain at least one substan
e (there are no dummies). So
it suÆ
es to
he
k that the supplement
ontains no other substan
e (then it must
automati
ally
ontain Vitamin C).
The following ER-s hema ontains (at least) 4 errors. Please identify them.
A2
HHH
A1 E1
(0; )
R2 (0; )
E2
(0; )
(0; ) B
C
R1 R3
(1; ) (1; 1)
A3 E3 E4
A4