Professional Documents
Culture Documents
Databaseexam PDF
Databaseexam PDF
INSTRUCTIONS:
• You
are
requested
to
work
on
the
answers
to
the
questions
contained
in
this
exam
individually,
and
for
90
minutes
in
total.
m
er as
• Submit
your
typed
answers
to
the
questions
below
on
Moodle,
as
a
single
file
in
pdf
format,
co
before
9pm
(Toronto
local
time)
on
April
23,
2020.
eH w
o.
rs e
ou urc
Academic Honesty Statement
The School of Information Technology has enacted a zero-tolerance policy for behaviors that
breach Senate Policies on Academic Honesty. The instructor has been requested to employ a variety of
o
measures, tools and heuristics to identify possible breaches of academic integrity, and to immediately
bring identified cases to the attention of the School's administration for further investigation and
aC s
vi y re
consideration of the full range of disciplinary measures. Possible penalties for violating academic honesty
policies may include zero on the test or assignment without an option to rewrite, failure in the course, a
permanent grade of record, and/or a transcript notation. Subsequent violations may result in suspension
or expulsion from the University. York University offers comprehensive resources that clarify academic
ed d
I have read and understood the above and I will absolutely adhere to the academic honesty rules
and policies laid by the instructor, the School of Information Technology and York University
is
Senate's Academic Integrity Policy. By beginning this activity I declare my intent and availability
Th
Please also include in the file containing the answers to the final exam questions the following
information:
(a) Where they are you physically located (City and Country)?
(b) How are you connecting to Moodle (Dial-up, DSL, cable, Wifi, etc.)?
(c) Are you using VPN to connect to Moodle?
1
This study source was downloaded by 100000838356707 from CourseHero.com on 12-09-2021 05:13:39 GMT -06:00
https://www.coursehero.com/file/71187502/DATABASEEXAMpdf/
Part 1 Functional Dependencies and Database Normalization [25 points]
Question 1 [4 points]
Consider the following database schema: R(A, B, C, D), FD = {A à B, BC à D, D à B, DàC}. Can
you give an example of a database instance that violates two of the functional dependencies in FD but
verifies the remaining two? If no, explain why not, if yes provide a database instance and specify which
dependencies fail on your instance.
Question 2 [8 points]
Consider a relation R(A, B, C, D) and the following set of functional dependencies, FD = {A à BD,
BCàD, B àD}.
m
er as
a) Provide a minimal cover for FD. (Provide the details of your work.)
co
eH w
b) Provide a 3NF decomposition of R, given FD. (Provide the details of your work.)
o.
rs e
ou urc
Question 3 [8 points]
Consider relation R(A, B, C, D, E, F) with the following set of functional dependencies: FD = {B à DE,
CE à B, EA à F, FàA}. Suppose you want to decompose R into BCNF, given FD. For each functional
o
dependency below check and indicate whether it violates the BCNF condition. If it does not violate the
aC s
BCNF condition, explain why. If it does, give the attributes that would be in R1 and R2 if you
vi y re
decomposed R into relations R1 and R2 based on that functional dependency, as well as the functional
dependencies in the projection of FD on R1 and R2.
a) CE à B
ed d
ar stu
b) B à DF
is
Th
Question 4 [5 points]
Consider the relation R(J, K, L, M, N, P, Q) with the following functional dependencies: {MP à N, JN
à QM, NQ à Q, LM à J, N à L}
sh
b) Give a minimal key for R. Explain why you know that this is a minimal key.
2
This study source was downloaded by 100000838356707 from CourseHero.com on 12-09-2021 05:13:39 GMT -06:00
https://www.coursehero.com/file/71187502/DATABASEEXAMpdf/
Part 2 Database Queries – SQL [75 points]
Consider the schema below:
Student(sID, surName, firstName, dID, email)
Department(dID, dName, campus)
Course(dID, cNum, name, breadth)
Instructor(iID, Name, dID, position, title)
Offering(oID, dID, cNum, year, iID)
Took(sID, oID, grade)
The following inclusion dependencies denote the foreign key constraints on this schema:
Student[dID] Í Department[dID]
Instructor[dID] Í Department[dID]
Course[dID] Í Department[dID]
Offering[iID] Í Instructor[iID])
Offering[dID, cNum] Í Course[dID, cNum]
Took[sID] Í Student[sID]
Took[oID] Í Offering[oID]
m
er as
co
Question 5 [10 points]
eH w
Write a query in SQL that returns all students who have taken at least one course in the campus they are
registered in. (The campus of a course offering is the campus of the department that offers the course. A
o.
rs e
student is considered to be registered in the campus of the department they are affiliated with.)
ou urc
Question 6 [10 points]
Write a query in SQL that returns for each student, the student’s name and the average of their grades
across all the courses they have taken. (All the grades obtained by the students are considered in the
o
calculation of the average, i.e., if a student has taken the same course multiple times, all the grades
aC s
instructor taught multiple offerings of the same course, that course is only counted once.)
ar stu
the course. An instructor’s home campus is the campus of the department they belong to.)
Th
3
This study source was downloaded by 100000838356707 from CourseHero.com on 12-09-2021 05:13:39 GMT -06:00
https://www.coursehero.com/file/71187502/DATABASEEXAMpdf/
Powered by TCPDF (www.tcpdf.org)