Anda di halaman 1dari 4

Question 1.

30 points
(1)Design an ER diagram for this application, and (2) convert the
ER diagram into a relational schema. Specify key attribtes of each
entity type and strctral constraints on each relationship type.
!ote any nspecified re"irements, and make appropriate
assmptions to make the specification complete.
a. #he niversity keeps track of each stdent$s name, stdent
nmber, social secrity nmber, crrent address and
phone, permanent address and phone, birth%date, se&,
class (freshman, sophomore'gradate), ma(or
department, minor department (if any), and degree
program ().*., ).S.,', +h.D.). Some ser applications
need to refer to the city, state, and ,ip of the stdent$s
permanent address and to the stdent$s last name. )oth
social secrity nmber and stdent nmber have ni"e
vales for each stdent.
b. Each department is described by a name, department
code, office nmber, office phone, and college. )oth name
and code have ni"e vales for each department.
c. Each corse has a corse name, description, corse
nmber, nmber of semester hors, level, and offering
department. #he vale of corse nmber is ni"e for each
corse.
d. Each section has an instrctor, semester, year, corse, and
section nmber. #he section nmber distingishes different
sections of the same corse that are taght dring the
same semester-year. its vales are 1, 2, /, ', p to the
nmber of sections taght dring each semester.
e. * grade report has a stdent, section, letter grade, and
nmeric grade (0, 1, 2, / or 1).
Question 2: 30 points
Specify the follo2ing "eries in S34 on the database schema of
figre1.
a. Retrieve the name of all senior stdents ma(oring in 56S6$
(6ompter Science).
b. Retrieve the names of all corses taght by professor
*bshama in 1789 and 178:.
c. ;or each section taght by +rofessor *bshama, retrieve the
corse nmber, semester, year, and nmber of stdents 2ho
took the section.
d. Retrieve the name and transcript of each senior stdent
(6lass<9) ma(oring in 56S6$. * transcript incldes corse
name, corse nmber, credit hors, semester, year, and
grade for each corse completed by the stdent.
e. Retrieve the names and ma(or departments of all * stdents
(stdents 2ho have a grade of * in all their corses).
f. Retrieve the names and ma(or departments of all stdents
2ho do not have a grade of * in any of their corses.
#able= S#>DE!#
!ame? StudentNumber ? 6lass ? @a(or
#able= 6A>RSE
6orse!ame ? CourseNumber ? 6reditBors ? Department
#able= +RERE3>CSC#E
CourseNumber ? PrerequisiteNumber
#able= SE6#CA!
SectionIdentifier ? 6orse!mber ? Semester ? Dear? Cnstrctor
#able= ER*DEFRE+AR#
StudentNumber ? SectionIdentifier ? Erade
;igre 1
2. Specify the follo2ing "eries in S34 on the database schema of
figre2.
a. Retrieve the names of all employees in department 9 2ho
2ork more than 10 hors per 2eek on the 5+ro(ectG$ pro(ect.
b. 4ist the names of all employees 2ho have a dependent 2ith
the same first name as themselves.
c. ;ind the names of all employees 2ho are directly spervised
by 5Asama *bshama$.
d. ;or each pro(ect, list the pro(ect name and the total hors per
2eek (by all employees) spent on that pro(ect.
e. Retrieve the names of all employees 2ho 2ork on every
pro(ect.
f. Retrieve the names of all employees 2ho do not 2ork on any
pro(ect.
g. Retrieve the average salary of all female employees.
h. ;ind the names and addresses of all employees 2ho 2ork on
at least one pro(ect located in Dblin bt 2hose department
has no location in Dblin.
i. 4ist the last names of all department managers 2ho have no
dependants.
#able= E@+4ADEE
;!*@E ? 4!*@E ? SSN ?)D*#E ? *DDRESS ? SEG ? S*4*RD ? S>+ERSS! ? D!>@
#able= DE+*R#@E!#
D!*@E ? DNUMBER ? @ERSS! ? @ERS#*R#D*#E
#able= DE+#F4A6*#CA!S
DNUMBER ? DLOCATION
#able= HARISFA!
ESSN ? PNUM ? BA>RS
#able= +RAJE6#
+!*@E ? PNUMBER ? +4A6*#CA! ? D!>@
#able= DE+E!DE!#
ESSN ? DEPENDENT_NAME ? SEG ? )D*#E ? RE4*#CA!SBC+
;igre 2
Question 3. 20 points
Consider the following two relational schemas and sets of functional
dependencies:
i. R(A,,C,!,"# with functional dependencies ! $% , C" $% A.
ii. &(A,,C,!,"# with functional dependencies A $% ", C $% A, !" $%.
'or each of the two schemas, do the following: !ecompose the relations, as
necessar(, into collections of relations that are in C)'. &how all of (our
wor* and e+plain which dependenc( ,iolations (ou are correcting -( (our
decompositions. .ou ha,e to turn in a description of (our decomposition
steps. &how: which is the relation that (ou are decomposing, what functional
dependenc( do (ou appl(, and which are the two resulting relations.
Question /. 20 points
0e sa( a set of attri-utes 1 is closed (with respect to a gi,en set of functional
dependencies# if 1
2
31. 4i,en the closed attri-ute sets, this gi,es us some information
on the underl(ing functional dependencies.
Consider a relation with schema R(A,,C,!# and an un*nown set of functional
dependencies. 'or each closed attri-ute set -elow, gi,e a set of functional
dependencies that is consistent with it.
All sets of attri-utes are closed.
a. All sets of attri-utes are closed.
-. 5he onl( closed sets are 67 and 6A,,C,!7.
c. 5he onl( closed sets are 67, 6A,7, and 6A,,C,!7.
.

Anda mungkin juga menyukai