0% found this document useful (0 votes)
118 views2 pages

CS43002: Database Management Systems Mid-semester-Examination, Spring 2014

The document describes a mid-semester examination for a database management systems course. It contains 4 questions: 1) draw an entity-relationship diagram; 2) write SQL queries; 3) express the SQL queries in relational calculus and Datalog rules; 4) identify functional dependencies and violations of Boyce-Codd normal form. The questions cover a range of database and data modeling concepts.

Uploaded by

Venkata Pranav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
118 views2 pages

CS43002: Database Management Systems Mid-semester-Examination, Spring 2014

The document describes a mid-semester examination for a database management systems course. It contains 4 questions: 1) draw an entity-relationship diagram; 2) write SQL queries; 3) express the SQL queries in relational calculus and Datalog rules; 4) identify functional dependencies and violations of Boyce-Codd normal form. The questions cover a range of database and data modeling concepts.

Uploaded by

Venkata Pranav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CS43002: Database Management Systems

'
Mid-semester-Examination, Spring 2014
Time= 2 hrs. Marks: 4 x 10 = 40. Answer all questions.

1. Use an Entity-Relationship Diagram to depict the following. Explain any additional assumptions you make
and list any aspects you were not able to depict.

A house is identified by a three-part address consisting of a number, street, and city. Each house also has a
style (e.g., bungalow, apartment) and a set of colours. A person is identified by a social security number. For
eac~ person we record his/her name, age, and sex. Persons who are at least 18 years old may own zero or
more houses, and every house is owned by at least one person. Any person (regardless of age) lives in at
most one house as his/her principal residence, and a house can have zero or more persons living there.

2.1. The semijoin of relations R and· S, is the bag of tuples t in R such that there is at least one tuple in S that
agrees with t in all attributes that R and S have in common. Give three different expressions in relational
algebra that are equivalent to the semijoin of Rand S.

2.2. Given the following relations from a university registration system.

Department(ID, name)

Faculty(ID, deptiD, firstName, lastName, joinYear)

Course(ID, deptiD, name, numOfCredits)

Student(ID, deptiD, firstName, LastName, joinYear)

Teaching(FacultyiD, courseiD, Year)

Registration(studentiD, courseiD, Year, grade)

The primary key in each relation is underlined. Each faculty member and each course belongs to exactly one
department. Each student also belongs to one department. However, a student can take courses outside
his/her department. Each faculty can teach many courses each year, and each taught course must have at
least 10 students. Write SQL statement for the queries given below.

(a) Report faculty members (Ids and names) who have taught courses outside their department.

(b) Report faculty members (Ids and names) who have taught courses of their own department that had at
least one student registered from another department.

3.1. Express the queries (a) and (b) in question 2.2 as statements in:

(i) Tuple relational calculus, (ii) Domain relational calculus

3.2. For each of the Datalog rules below, write an expression of relational algebra that defines the same
relation as the head of the rule.

(a)P(x, y) ,_ Q(x, z) AND R(z, y)

(b)P(x, y) .- Q(x, z) AND R(z, y) AND x < y


} .,
.I

~
'· .... ~

·'

f
~
' ~ ' . i ,,

a.
4.1. We say set of qttributes X is closed ·(with resJ)ect·to a. given set qf FD's) if,..x+ =,X. Consider .a relation
witp schema R(A, 8, c; D) and ~n unkQoWn, set of:FD's. If we .are· tqld whicl) set~ 'of::.attril:ll.Jtes are closed, ·we
can discover the FD's. What are-.the FD:s if: ·: · ; · .. .,.
"""

(a) J.\11 sets of the, four: attribUtes·a~e:closed.

(b)
.
The·only.clo~ed sets are 0 and {A, 8, C;,..D}
' .. '
<
,• . . .
· t, .,
.,;,.-
·~~· .
"' ~'

(c) The, closed sets are. 0, {A,,.B}, ang {A, B; C, D) ,.


~ ·~~ ~·· ~~. ' '

4.2 . .Consider the, ·relation:schema R(A:~a, ·C, D, 'E)with. §e,t ofFQ'..s: ABA .c, G~ Q, ri-JB, anq.D...,;. E.
l
~ ~ ~

(a) lndlcat~r'all BCNF ·violation~: D'o notforgetto·conslder FD's~thaf are··nc>.t~ iJi the,;giv.§n" ·set' but 'follow from ·
them. However, it. is not nec~ssary togiveN'iqlqtjpns·that. hav.e mqte than:"on.~ attribute on the fig lit side.
l '· . A . . " • .., , •' ,
,,
(o) Decompose. the relation ,into collectidll .of .refatidri~'that are in'BCNF. . ·· '·
Jl
'

.. ,, &

,,., '
(c).lndic~te.all3NF violatio.ns..

~~ 1
.' ~

' I

(d) Qecompose the re[~tion into collections of'relatio~s th.at are in 3N(., ..."'
,
.
·•' .. ·~

,. •..
~

,.
.... '" ] a
w

.~
":l

,.! ''l.,
'I\,
"'·
..' ·'
:_; ~
~'~>
~+~
i!"

"
""~ ~ '"·~
-.-~---------·BEST WISHES.~:. •.. ~....:___ ~· ll,.·~ ~ \. ,:"!'.
~~ ~ ~
~ ~ t

'
;..,
~
~
~ if;"., ('.;,
...
' </' l~·
' i ~
\
J \

.,
'1 'I
~
'\'¥

~ r
,. 'I'

,, ·,·,.

'} l
..,
~ ~
~ >:

,
1''
,.
.
..
~

~ ,, .,
"'
J, "'
\\,

" ~'"'
~ ~'~ ..,

'§ :~
~ .<
' " ~
/''
'{ l
•''
" J
~

il·

'-~~~~~-~--:.~~----~.:_
~."-.,

' ..,."/'' 1' ~:J :'••


______________ -
::,

You might also like