Dbms Question
Dbms Question
October 2016
SOLUTION
1. Find out a minimal cover of the set of functional dependency F = {AB CD, BC D, B C, B
D} specified on a relation schema R(A, B, C, D).
(5)
(5)
(5)
Ans. Since the attributes of R are atomic hence R is in first normal form. But it is not in second normal
form because of the functional dependency G D (which is a partial functional dependency). So we
decompose R into two schemas namely, R1(G, D) and R2(A, B, C, E, G). The schema R1 is in third normal
form (in fact it is BCNF). The schema R2 is in second normal form but it is not in third normal form
because of the functional dependency AB E. So we decompose R2 into two schemas namely, R3(A, B,
E) and R4(A, B, C, G). So the decomposition D = {R1, R3, R4}.
The primary keys are underlined in the schemas.
The set of attributes {A, B} in the schema R4 is a foreign key that refers to the schema R3 and another
foreign key of R4 is the attribute G and it refers to the schema R1.
4. Find out whether the following sets of functional dependency specified on a relation schema R(A, B, C,
D, E) are equivalent.
F1 = {A C, A B, BC D} and F2 = {A BC, A E, B D}.
(5)
Ans. Consider the functional dependency A BC of the set F2. (A)+ with respect to F1 is (A)+ = A U C =
AC = AC U B = ABC U D = ABCD and this set contains the right hand side of A BC and hence A
BC can be inferred from F1. Again consider the other functional dependency A E of F2 and (A)+ with
respect to F1 as before produces ABCD and this set does not contain the right hand side of A E and
hence A E cannot be inferred from F1. So F1 and F2 are not equivalent.
PART B (3 10 = 30)
5. Consider the following information about a university database.
Professors have a social security number, a name, an age, a rank and a research specialty. Projects have a
project number, a sponsor name (e.g., DST), a starting date, an ending date and a budget. Graduate students
have a social security number, a name, an age and a degree program (e.g., M.S. or Ph.D.). Each project is
managed by one professor (known as the project's principal investigator). Each project is worked on by one
or more professors (known as the project's co-investigators). Professors can manage and/or work on
multiple projects. Each project is worked on by one or more graduate students (known as the project's
research assistants). When graduate students work on a project, a professor must supervise their work on
the project. Graduate students can work on multiple projects, in which case they will have a (potentially
different) supervisor for each one. Departments have a department number, a department name and a main
office. Departments have a professor (known as the chairman) who runs the department. The Professors
work in one or more department and for each department that they work in, a time percentage is associated
with their job. Graduate students have one major department in which they are working on their degree.
Each graduate student has another more senior graduate student (known as a student advisor) who advises
him or her on what courses to take.
Draw an entity-relationship (ER) diagram that captures the above information about the university. Indicate
key constraints, cardinality constraints and participation constraints on the diagram.
(10)
Ans.
6. (a) Convert the ER diagram obtained from question 5 into a relational database schema. Indicate the
primary key and foreign key on the schema and document the secondary key (if any).
(5)
Professor
ssn
name
age
rank
speciality
dno
Project
pid
start_date
end_date
sponsor
budget
prof_ssn
Student
ssn
name
age
deg_prog
std_ssn
dno
Department
dno
name
Office
Work_dept
prof_ssn
dno
pc_time
Work_in
prof_ssn
pid
Work_proj
prof_ssn
ssn
pid
(b) Suppose that we have the following three tuples in a state of a relation schema R with three attributes A,
B, and C (listed in order): (1, 2, 3), (4, 2, 3) and (5, 3, 3). Which of the functional dependencies A B, BC
A and B C does not hold on the schema R? Can you identify any functional dependency that holds on
R?
(5)
Ans. A B holds because for every value of A there exists a unique value of B and for the same reason B
C also holds. But BC A does not hold because for the same pair (2, 3) on (B, C) there are two
different values of A, namely 1 and 4.
7. Design a database to keep track of information for an art museum. Assume that the following
requirements were collected.
The museum has a collection of ART_OBJECTS. Each ART_OBJECT has a unique Id_no, an Artist (if
known), a Year (when it was created, if known), a Title, and a Description. The art objects are categorized
in several ways. ART_OBJECTS are categorized based on their type. There are three main types:
PAINTING, SCULPTURE, and STATUE, plus another type called OTHER to accommodate objects that
do not fall into one of the three main types. A PAINTING has a Paint_type (oil, watercolor, etc.), material
on which it is Drawn_on (paper, canvas, wood, etc.) and Style (modern, abstract, etc.). A SCULPTURE or
a statue has a Material from which it was created (wood, stone, etc.), Height, Weight and Style. An art
object in the OTHER category has a Type (print, photo, etc.) and Style. ART_OBJECTs are categorized as
either PERMANENT_COLLECTION (objects that are owned by the museum) and BORROWED.
Information captured about objects in the PERMANENT_COLLECTION includes Date_acquired, Status
(on display, on loan, or stored) and Cost. Information captured about BORROWED objects includes the
Collection from which it was borrowed, Date_borrowed and Date_returned. Information describing the
country or culture of Origin (Italian, Egyptian, American, Indian, and so forth) and Epoch (Renaissance,
Modern, Ancient, and so forth) is captured for each ART_OBJECT. The museum keeps track of ARTIST
information, if known: Name, Date_born (if known), Date_died (if not living), Country_of_origin, Epoch,
Main_style and Description. The Name is assumed to be unique. Different EXHIBITIONS occur, each
having a Name, Start_date and End_date. EXHIBITIONS are related to all the art objects that were on
display during the exhibition.
Draw an EER diagram that captures the above information. Indicate key constraints, cardinality constraints
and participation constraints.
(10)
Ans.