You are on page 1of 4

Final Examination, Csci 4707, Fall 2002

Time Allocated: 120 minutes


This is an OPEN book examination. Personal copies of textbook, supplementary book, an class notes can be use but
NOT share.
There are !uestions each "ith # parts. $se a blue book to ans"er these !uestions. %tart ans"er to each part of a
!uestion on a fresh pa&e. Put name, stuent i, email aress, class &roup, course i, course name, semester an year
on the co'er pa&e.
(ll !uestions about %)* refer to the %)*2 or %)*+ stanar.
Question 1.
(lice has a lar&e ,-, mo'ie collection. .er friens like to borro" her ,-,/s, an she nees a "ay to keep track of "ho
has "hat. %he maintains a list of friens, ientifie by uni!ue 01,/s 2frien ientifiers3 an a list of ,-,/s, ientifie by
,-,1,/s 2,-, ientifiers3. 4ith each frien is the name an the all5important telephone numbers "hich she can call to
&et the ,-, back. 4ith each ,-, is the star actor name an title. 4hene'er a frien borro"s a ,-,, (lice "ill enter
that fact into her atabase alon& "ith the ate borro"e. 4hene'er the ,-, &ets returne, that fact, too, &ets note alon&
"ith the ate returne. (lice "ants to keep a complete history of her friens/ borro"in& habits so that she can ask fa'ors
of the hea'y borro"ers 2or perhaps refuse to make further loans to those "ho habitually on/t return them !uickly3.
Q1a. 6elo" is an E57 ia&ram for a atabase to help (lice out. Pro'ie appropriate names for entities E1,E28 attributes
(1, (2,9.(:8 multi5'alue attribute (#, relationship 71, an carinality constraint ;1min, ;1max, ;2min an ;2max.
Entity E1 : <ey <1 : (ttribute (1 : (ttribute (2 :
Entity E2 : <ey <2 : (ttribute (: : =ulti5'alue (ttribute (# :
7elationship 71: (ttribute (+ : (ttribute (> :
;arinality ;1min : ;1max : ;2max : ;2min :
Q1b. 7epresent this atabase as a collection of +N0 relational tables. ?ou nee not specify ata types for columns.
Q1c. 4hich of the follo"in& !uestions can ans"er from your E7 ia&ram@2multiple choices3 6riefly Austify the ans"ers.
2(3 4ho are the hea'y borro"ers@
263 4ho habitually onBt return ,-,Bs !uickly@
2;3 4ho borro"e a ,-, multiple times@
2,3 4ho "ill be hea'y borro"ers@
2E3 4hich ,-,s are borro"e by someone at present@
Question 2.
Q2a. ;onsier t"o E57 moels. =oel ( consists of t"o entities an one relationship Aoinin& them. The entities are
lecturer an course an the relationship is teaches. The secon moel consists of three entities8 the first an the thir are
the same as abo'e but the secon entity is calle lecture. The first an secon entities are Aoine by a relationship calle
gives "hile the secon an the thir entities are Aoine by a relationship calle of.
4hich t"o of the follo"in& are correct@ 6riefly Austify your ans"ers.
2(3 6oth moels allo" a course to ha'e more than one lecture from the same lecturer
263 =oel 6 is more appropriate if information about all lectures, past an present, is to be store
2;3 =oel ( oes not allo" lecture ate an time to be store
2,3 =oel 6 leas to more tables than =oel ( oes "hen translate to the relational moel
E1 E2
71
(1
(2
(+ (>
(:
+
(#
<2 <1
;1min, ;1max ;2man, ;2min
Q2b. 1n the instance of the relation 72(,6,;,,,E3 sho"n belo", "hich of the follo"in& functional epenencies 20,/s3
hol@ 6riefly Austify your ans"er.
( 6 ; , E
1 2 + > :
1 > + > :
1 2 > > 1
1. (65C ; 11. 65C , 111. ,E5C(
2(3 1 only 263 11 only 2;3 1 an 111 only 2,3 11 an 111 only
Q2c. ;onsier a relation 72(,6,;,,3. %uppose "e "ant to enforce the functional epenency (5C6; in 7 usin& %)*+
tri&&ers. 4hich of the follo"in& tri&&erin& e'ents are re!uire@ 6riefly Austify your ans"er.
1. $P,(TE O0 , ON 7 11. ,E*ETE ON 7
2(3 1 only 263 11 only 2;3 6oth 1 an 11 2,3 Neither 1 nor 11
Question 3.
Q3a. ;onsier the follo"in& schema.
%tuent2%sn, Name3
Taken;ourses2%sn, ;ourseNo3
7e&ister2%sn, ;ourseNo3
;ourse2;ourseNo, Name, ?ear, Term3
Pre7e!uisite2;ourseNo, 7e!;ourseNo3
Table Taken;ourses mana&es courses info that a stuent has taken. ( course may re!uire pre5re!uisite courses an the
pre5re!uisite course info is mana&e in table Pre7e!uisite. 0ill the blanks of the follo"in& tri&&er to check if the stuent
took the pre5re!uisite courses "hen sDhe re&isters for a ne" course. 1f sDher inBt take a prere!uisite course, the
re&istration of the course shoul fail.
;7E(TE T71EEE7 PreFre!uisiteFcheck
(0TE7 213 FFFFFFFFF ON 7e&ister
0O7 E(;. 7O4
4.EN 20 G 2%E*E;T ;O$NT27e!;ourseNo3 07O= Pre7e!uisite
4.E7E ;ourseNoH223FFFFFFFFFFFFFF
(N, 7e!;ourseNo NOT 1N 2%E*E;T ;ourseNo
07O= Taken;ourses
4.E7E 2+3FFFFFFFF3
7(1%EFE77O78

Q3b. ;onsier the follo"in& schema.
Employee2%sn, Name, %alary, ,no, %uper'isorF%sn3
,epartment2,no ,,name, TotalF%al, =ana&erF%sn3
Table ,epartmentBs TotalF%al is a eri'e attribute, "hose 'alue shoul be the sum of the salaries of all employees
assi&ne to the particular epartment. To upate the 'alue of TotalF%al automatically, "hen the epartment of an
employee is chan&e, "e nee to transfer the employeeBs salary from his ol epartment to his ne" epartment.
0ill the blanks of the follo"in& tri&&er to maintain the 'alue of TotalF%al in epartment correctly "hen an employee
chan&es hisDher epartment.
;7E(TE T71EEE7 TotalsalFupate
213FFFFFFFFFFFFFFFF O0 ,no ON Employee
0O7 E(;. 7O4
4.EN NE4.%alary 1% NOT N$**
6EE1N
$P,(TE ,epartment
%ET TotalFsal H 223FFFFFFFFFFFFFFFFFFFFF
4.EN ,no H 2+3FFFFFFFFFFFFFFFFFF8
$P,(TE ,epartment
%ET TotalFsal H 2+3FFFFFFFFFFFFFFFFFFFFF
4.EN ,no H 2>3FFFFFFFFFFFFFFFFFF8
EN,:

Q3c. ;onsier the follo"in& schema.
Enroll2%tuent1,, ;ourse1,, Term, Erae3
%uppose "e "ant to fin the a'era&e &rae of the ;%>I0I class in 0all 2002.(ssume that there is no other inex on
Enroll. 4hich one of the follo"in& four options "ill likely pro'ie the bi&&est performance impro'ement for our !uery@
6riefly Austify your ans"er.
2(3 ;reate an inex on Enroll2%tuent1,3
263 ;reate an inex on Enroll2%tuent1,3 an another inex on Enroll2Erae3
2;3 ;reate an inex on Enroll2;ourse1,3an another inex on Enroll2Term3
2,3 ;reate an inex on Enroll2;ourse1,, Term3
Question 4.
Q4a. ,etermine truthDfalsehoo of follo"in& each statement. 6riefly Austify your ans"ers
1. 4eak Entity is an entity type that borro"s all of its primary key from another entity type.
2. 1n &eneraliJation hierarchies, an entity type can be subtype of t"o or more entity types.
+. The number of relationships in a star schema is one less than the number of entities.
>. =ile"are is use in 25tier client5ser'er architecture.
:. ( fra&ment efinition may in'ol'e Aoin o'er t"o tables.
Q4b. ;onsier the follo"in& %)*+ statements that create three ne" types an t"o tables:
;7E(TE T?PE Point (% 2 K N$=6E7, ? N$=6E7,
=ET.O, ,istance2P2 Point3 7ET$7N% N$=6E738
;7E(TE T?PE PolyType (% (77(?2:003 O0 Point8
;7E(TE T?PE Poly&on (% 2 NumberOfPoints N$=6E7, Eeometry PolyType,
=ET.O, (rea23 7ET$7N% N$=6E738
;7E(TE T(6*E ;ity 2Name ;.(72+03, Population N$=6E7, %hape Point38
;7E(TE T(6*E ;ountry 2Name ;.(72+03, Ep N$=6E7, %hape Poly&on38
4rite the follo"in& !ueries usin& %)*+ syntax,
1. *ist all countries 2name an &p3 in the ;ountry table "hose area is &reater than 20,000 units.
2. *ist all pairs of cities in the ;ity table "hose istance is less than 1,000 units.
Q4c. 0ill the blanks of the follo"in& %)*+ statements to create a table to store information about epartments. Each
epartment has a uni!ue epartment number an a mana&er. ,epartment number is store usin& %)* ata type
N$=6E7. =ana&er attribute has a user efine ata type of EmployeeFt, "hich is a subtype of PersonFt. Each instance
of PersonFt has a name an a ate of birth. EmplolyeeFt has a salary attribute as "ell.
;7E(TE 7O4 T?PE PersonFt 2213FFFFF ;.(72203, 223FFFF ,(TE38
;7E(TE 7O4 T?PE EmployeeFt 22+3FFFFFF N$=6E73 $N,E7 2>3FFFFFFF8
;7E(TE T(6*E ,ept22:3FFFF 2#3FFFFFFF , 2I3FFFFFF N$=6E738
Question 5.
Q5a. ;onsier the follo"in& star schema:
,imension tables : ;ustomer2;ust1,, Name, (ress, Lipcoe3
Prouct2Pro1,, Name, $nitPrice, ;olor3
0act table : %ales2 ;ust1,, Pro1,, )uantity, Price3
4rite %)* expression for the follo"in& !ueries
1. ;ompute ;$6E of the %ales fact table 2$se multiple %E*E;T statements instea of ;$6E operator.3
2. *ist total sale of proucts for each color to customers in Lipcoe ::>::.
Q5b. ;onsier the follo"in& atabases schema.
%tuent2%sn, Name, =aAor3
;ourse2;ourseNo, Name, ,escription, ,epartment, ;reits3
Offere2;ourseNo, %emester, ?ear, 1nstructor1, *ocation3
1nstructor21nstructor1, Name, ,epartment3
Enroll2%sn, ;ourseNo, %emester, ?ear, Erae3
4rite %)* expression for the follo"in& !uestions about the security aspects of abo'e atabase.
2Note : ?ou are o"ner of abo'e atabase an ?ou &rants belo" task to MstuentKKB user an MProf%hekharB user usin&
&rantDre'oke statements an creatin& 'ie" "hene'er necessary.3
1. %tuent can 'ie" all the information in the course an instructor tables except for 1nstructor1.
2. %tuent can also 'ie" the courseno, semester, year, location an instructor name2not instructori3 of all courses that are
bein& offere.
+. 1nstructor, MProf%hekharB can 'ie" enrollment info2ssn, courseno, semester, year, &rae3 of stuents "ho are in his
classes but only chan&e the &rae.
Q5c. ;onsier the follo"in& atabase schema o"ne by userK.
Employee2%sn, Name, %alary, %upperssn, ,no3
4orksFon2Essn, Pno, .ours3
ProAect2Pno, Pname, ,no3
;onsier the follo"in& %)*s. 4hich statements fail urin& execution@ 6riefly Austify your ans"ers. 2Note: NuserKO means
that userK executes the follo"in& %)* statements.3
NuserKO
213 7E-O<E (** ON Employee 07O= P$6*1;8
223 7E-O<E (** ON 4orksFon 07O= P$6*1;8
2+3 7E-O<E (** ON ProAect 07O= P$6*1;8
2>3 ;7E(TE -1E4 %uper'isor+
(% %E*E;T %sn, Name 07O= Employee 4.E7E noH+8
2:3 E7(NT %E*E;T ON %uper'isor+ TO user(8
2#3 E7(NT %E*E;T ON 4orksFon TO user68
2I3 E7(NT $P,(TE ON 4orksFon2.ours3 TO user68
Nuser(O
2P3 %E*E;T Q 07O= %uper'isor+8
2R3 1N%E7T 1NTO %uper'isor+ -(*$E%2++:12, M%mithB38
Nuser6O
2103 %E*E;T Essn, .ours 07O= 4orksFon8
2113 ;7E(TE 1N,EK 4orksFonFin ON 4orksFon2.ours38
2123 $P,(TE 4orksFon %ET .oursHP, PnoH10 4.E7E EssnH++>1:8

You might also like