You are on page 1of 21

Section 12 1.

Entity integrity refers to Mark for Review (1) Points Tables always containing text data Tables always containing n !eric data "ol !ns #aving Pri!ary $eys% &oreign $eys% 'ni( e $eys and "#eck constraints defined in t#e database. Tables #aving Pri!ary $eys% &oreign $eys% 'ni( e $eys and "#eck constraints defined in t#e database. ()) *ncorrect. Refer to Section 12 2. T#e ex+lanation below is a 'ser ,efined integrity r le and ! st t#erefore be !an ally coded% t#e ,atabase cannot enforce t#is r le a to!atically. +ri!ary key ! st be ni( e% and no +art of t#e +ri!ary key can be n ll. Tr e or &alse/ Mark for Review (1) Points Tr e &alse ()) "orrect 0. T#e ex+lanation below is a col !n integrity constraint. col !n ! st contain only val es consistent wit# t#e defined data for!at of t#e col !n. Tr e or &alse/ Mark for Review (1) Points Tr e ()) &alse "orrect

1. T#e text below is an exa!+le of w#at constraint ty+eT#e val e in t#e !anager2id col !n of t#e EMP345EES table ! st !atc# a val e in t#e e!+loyee2id col !n in t#e EMP345EES table. Mark for Review (1) Points Entity integrity 'ser6defined integrity "ol !n integrity Referential integrity ()) "orrect 7. .n 8.rc *!+le!entation8 can be done 9 st like any ot#er Relations#i+ 6 yo si!+ly add t#e re( ired &oreign $eys. Tr e or &alse/ Mark for Review (1) Points Tr e &alse ()) "orrect :. ;#ic# of t#e following are reasons w#y yo s#o ld consider sing a S bty+e *!+le!entation/ Mark for Review (1) Points T#e res lting table will reside in a single database and be sed by 9 st 4<E ser. ;#en t#e co!!on access +at#s for t#e s +erty+es are different. = siness f nctionality and b siness r les% access +at#s and fre( ency of access are all very different between s bty+es. ()) Most of t#e relations#i+s are at t#e s +erty+e level "orrect

>. ;#at do yo create w#en yo transfor! a !any to !any relations#i+ fro! yo r ER diagra! into a +#ysical design/ Mark for Review (1) Points 'ni( e key constraints *ntersection entity *ntersection table ()) Two tables wit# &oreign key constraints between t#e! "orrect ?. 4ne6to64ne relations#i+s are transfor!ed into "#eck "onstraints in t#e tables created at eit#er end of t#at relations#i+. Tr e or &alse/ Mark for Review (1) Points Tr e &alse ()) "orrect @. ;#y wo ld t#is table na!e <4T work in an 4racle database/ t#is2year2endAnext2year Mark for Review (1) Points Table na!es ! st begin wit# an al+#abetic c#aracter Too long T#e Pl s sign A is not allowed in ob9ect na!es ()) <one of t#e above "orrect

1B. T#e transfor!ation fro! an ER diagra! to a +#ysical design involves c#anging ter!inology. Secondary 'ni( e *dentifiers beco!e Mark for Review (1) Points "ol !ns Tables 'ni( e "onstraints ()) Pri!ary $ey "onstraints "orrect Section 12 11. *n a +#ysical data !odel% a relations#i+ is re+resented as a co!bination of- ("#oose Two) Mark for Review (1) Points ("#oose all correct answers) "ol !n Pri!ary $ey or 'ni( e $ey ()) "#eck "onstraint or 'ni( e $ey &oreign $ey ()) *ncorrect. Refer to Section 12

Section 10 12. ;#at co!!and can be sed to create a new row in a table in t#e database/ Mark for Review (1) Points "RE.TE <E;

.,, *<SERT ()) *ncorrect. Refer to Section 10 10. T#e 2222222 cla se can be added to a SE3E"T state!ent to ret rn a s bset of t#e data. Mark for Review (1) Points .<5;CERE ;C*"C ;CERE ()) EDER5 "orrect.

Section 1: 11. ;o ld it be a good idea to !odel age as an attrib te of ST',E<T/ Mark for Review (1) Points 5es Maybe it co ld sto+ s #aving to calc late so!eoneEs age every ti!e we need it So!eti!es <o 6 it breaks t#e <or!aliFation r les ()) *ncorrect. Refer to Section : 17. ;#en is an entity in 2nd <or!al &or!/ Mark for Review

(1) Points ;#en all non6'*, attrib tes are de+endent +on t#e entire '*,. ()) ;#en no attritib tes are ! t ally inde+endant and f lly inde+endent on t#e +ri!ary key. ;#en no attritib tes are ! t ally inde+endent and all are f lly de+endent on t#e +ri!ary key. <one of t#e .bove. "orrect 1:. 5o ( ery t#e database wit# t#is SG3 state!entSE3E"T ) &R4M transaction ;CERE +rod ct2id H 17:@I ;#ic# SG3 SE3E"T state!ent ca+abilities are ac#ieved w#en t#is state!ent is exec ted/ Mark for Review (1) Points Selection only ()) Pro9ection only Selection and +ro9ection only Pro9ection% selection and 9oining "orrect. 1>. ;#ic# SG3 state!ent will ret rn an error/ Mark for Review (1) Points SE3 ) &R skyI ()) select star fro! skyI SE3E"T star &R4M skyI

SE3E"T ) &R4M skyI *ncorrect. See Section 1: 1?. 5o want to create a list of all alb !s t#at #ave been +rod ced by t#e co!+any. T#e list s#o ld incl de t#e title of t#e alb !% t#e artistEs na!e% and t#e date t#e alb ! was released. T#e .3='MS table incl des t#e following col !ns.3=2T*T3E D.R"C.R2(17B) <4T <'33 .3=2.RT*ST D.R"C.R2(17B) <4T <'33 .3=2,.TE ,.TE <4T <'33 ;#ic# state!ent can yo Mark for Review (1) Points SE3E"T ) &R4M alb !sI ()) SE3E"T alb2title% alb2artist% alb2dates &R4M alb !I SE3E"T alb2title% alb2artist% alb2dates &R4M alb !sI SE3E"T alb2titleI alb2artistI alb2date &R4M alb !sI se to retrieve t#e necessary infor!ation/

*ncorrect. See Section 1: 1@. 5o ( ery t#e database wit# t#is SG3 state!entSE3E"T ) &R4M st dentsI ;#y wo ld yo se t#is state!ent/ Mark for Review (1) Points

To insert data To view data ()) To dis+lay t#e table str ct re To delete data "orrect. 2B. ;#en listing col !ns in t#e SE3E"T list% w#at s#o ld yo col !ns/ Mark for Review (1) Points "o!!as ()) Se!icolons ,as#es 'nderscores *ncorrect. See Section 1: Section 1: 21. T#e EMP345EES table contains t#ese col !nsS.3.R5 <'M=ER(>%2) =4<'S <'M=ER(>%2) "4MM*SS*4<2P"T <'M=ER(2%2) .ll t#ree col !ns contain val es greater t#an Fero. T#ere is one row of data in t#e table and t#e val es are as followsSalary H 7BB% =on s H 7B% "o!!ission2+ct H .7 Eval ate t#ese two SG3 state!ents1. SE3E"T salary A bon s A co!!ission2+ct ) salary 6 bon s .S inco!e &R4M e!+loyeesI se to se+arate t#e

2. SE3E"T (salary A bon s ) A co!!ission2+ct ) (salary 6 bon s) inco!e &R4M e!+loyeesI ;#at will be t#e res lt/ Mark for Review (1) Points State!ent 1 will ret rn a #ig#er val e t#an state!ent 2. State!ent 2 will ret rn a #ig#er val e t#an state!ent 1. ()) State!ent 1 will dis+lay a different col !n #eading. 4ne of t#e state!ents will <4T exec te. *ncorrect. See Section 1: 22. *n a SE3E"T cla se% w#at is t#e res lt of 2 A 0 ) 2/ Mark for Review (1) Points : ? ()) 1B 10 "orrect.

Section 1> 20. Eval ate t#is SE3E"T state!entSE3E"T last2na!e% first2na!e% salary &R4M e!+loyeesI Cow will t#e #eading for t#e S.3.R5 col !n a++ear in t#e dis+lay by defa lt in 4racle .++lication Ex+ress/ Mark for Review

(1) Points T#e #eading will dis+lay wit# t#e first c#aracter ca+italiFed and centered. T#e #eading will dis+lay wit# t#e first c#aracter ca+italiFed and left 9 stified. T#e #eading will dis+lay as ++ercase and centered. ()) T#e #eading will dis+lay as ++ercase and left 9 stified. *ncorrect. See Section 1>. 21. 5o need to dis+lay all t#e e!+loyees w#ose last na!e starts wit# t#e letters S! . ;#ic# ;CERE cla se s#o ld yo se/ Mark for Review (1) Points ;CERE last2na!e 3*$E ES!JE ()) ;CERE last2na!e 3*$E EJS!E ;CERE last2na!e 3*$E E2S!E ;CERE last2na!e 3*$E ES!2E *ncorrect. See Section 1> 27. 5o want to deter!ine t#e orders t#at #ave been +laced by c sto!ers w#o reside in "#icago. 5o write t#is +artial SE3E"T state!entSE3E"T orderid% orderdate% total &R4M ordersI ;#at s#o ld yo incl de in yo r SE3E"T state!ent to ac#ieve t#e desired res lts/ Mark for Review (1) Points .<, city H "#icagoI .<, city H E"#icagoEI ;CERE city H E"#icagoEI ()) ;CERE city H "#icagoI

"orrect. 2:. ;#ic# SE3E"T state!ent will dis+lay bot# ni( e and non6 ni( e co!binations of t#e M.<.KER2*, and ,EP.RTME<T2*, val es fro! t#e EMP345EES table/ Mark for Review (1) Points SE3E"T !anager2id% de+art!ent2id ,*ST*<"T &R4M e!+loyeesI SE3E"T !anager2id% de+art!ent2id &R4M e!+loyeesI ()) SE3E"T ,*ST*<"T !anager2id% de+art!ent2id &R4M e!+loyeesI SE3E"T !anager2id% ,*ST*<"T de+art!ent2id &R4M e!+loyeesI *ncorrect. See Section 1>. 2>. T#e P3.5ERS table contains t#ese col !nsP3.5ER2*, <'M=ER(@) 3.ST2<.ME D.R"C.R2(2B) &*RST2<.ME D.R"C.R2 (2B) TE.M2*, <'M=ER (1) M.<.KER2*, <'M=ER (@) P4S*T*4<2*, <'M=ER (1) ;#ic# SE3E"T state!ent s#o ld yo se if yo want to dis+lay ni( e co!binations of t#e TE.M2*, and M.<.KER2*, col !ns/ Mark for Review (1) Points SE3E"T ) &R4M +layersI SE3E"T tea!2id% !anager2id &R4M +layersI SE3E"T ,*ST*<"T tea!2id% !anager2id &R4M +layersI ()) SE3E"T tea!2id% ,*ST*<"T !anager2id &R4M +layersI SE3E"T tea!2id% !anager2id ,*ST*<"T &R4M +layersI

*ncorrect. See Section 1>. 2?. T#e ST',E<T table contains t#ese col !nsST',E<T2*, <'M=ER(1B) Pri!ary $ey 3.ST2<.ME D.R"C.R2(27) &*RST2<.ME D.R"C.R2(27) M.*<2S'=LE"T2*, <'M=ER(0) .,D*S4R2*, <'M=ER(7) Eval ate t#is state!entSE3E"T ,*ST*<"T advisor2id% !ain2s b9ect2id &R4M st dentI ;#ic# state!ent is tr e/ Mark for Review (1) Points Eac# .,D*S4R2*, can be dis+layed only once. Eac# M.*<2S'=LE"T2*, can be dis+layed !ore t#an once +er .,D*S4R2*,. ()) Eac# co!bination of .,D*S4R2*, and M.*<2S'=LE"T2*, can be dis+layed !ore t#an once. Eac# M.*<2S'=LE"T2*, can be dis+layed only once +er ( ery. "orrect. See Section 1> 2@. *f yo write ( eries sing t#e =ET;EE< o+erator it does not !atter in w#at order yo enter t#e val es% i.e. =ET;EE< low val e .<, #ig# val e will give t#e sa!e res lt as =ET;EE< #ig# val e and low val e. Tr e or &alse/ Mark for Review (1) Points Tr e &alse ()) *ncorrect. See Section 1>. 0B. T#e EMP345EES table contains t#ese col !ns3.ST2<.ME D.R"C.R2(27)

&*RST2<.ME D.R"C.R2(27) EM.*3 D.R"C.R2(7B) 5o are writing a SE3E"T state!ent to retrieve t#e na!es of e!+loyees t#at #ave an e!ail address. SE3E"T last2na!eMME% EMMfirst2na!e 8E!+loyee <a!e8 &R4M e!+loyeesI ;#ic# ;CERE cla se s#o ld yo Mark for Review (1) Points ;CERE e!ail H <'33I ;CERE e!ail NH <'33I ;CERE e!ail *S <'33I ;CERE e!ail *S <4T <'33I ()) *ncorrect. See Section 1>. Section 1> 01. T#e "oncatenation 4+erator does w#ic# of t#e following/ Mark for Review (1) Points 3inks rows of data toget#er inside t#e database. 3inks two or !ore col !ns or literals to for! a single o t+ t col !n ()) *s re+resented by t#e asterisk ()) sy!bol Se+arates col !ns. *ncorrect. See Section 1> 02. 5o need to dis+lay only ni( e co!binations of t#e 3.ST2<.ME and M.<.KER2*, col !ns in t#e EMP345EES table. ;#ic# keyword s#o ld yo incl de in t#e SE3E"T cla se/ Mark for Review (1) Points se to co!+lete t#is state!ent/

4<35 '<*G'E ,*ST*<"T ()) ,*ST*<"TR4; "orrect. See Section 1> 00. ;#ic# state!ent best describes #ow col !n #eadings are dis+layed by defa lt in 4racle .++lication Ex+ress- Mark for Review (1) Points "ol !n #eadings are dis+layed left69 stified and in lowercase. "ol !n #eadings are dis+layed left69 stified and in ++ercase. "ol !n #eadings are dis+layed centered and in ++ercase. ()) "ol !n #eadings are dis+layed centered and in !ixed case. "orrect. See Section 1> 01. 5o need to dis+lay e!+loyees w#ose salary is in t#e range of 0BBBB and 7BBBB. ;#ic# co!+arison o+erator s#o ld yo se/ Mark for Review (1) Points *< 3*$E =ET;EE<....<,... ()) *S <'33 "orrect. 07. ;#en sing t#e 3*$E condition% w#ic# sy!bol re+resents any se( ence of none% one or !ore c#aracters/ Mark for Review

(1) Points 2 J ()) O P "orrect. 0:. ;#ic# co!+arison condition wo ld yo +attern/ Mark for Review (1) Points *< 3*$E ()) .3M4ST S*M*3.R "orrect. se to select rows t#at !atc# a c#aracter

Section 1? 0>. T#e EMP345EES table contains t#ese col !nsEMP345EE2*, <'M=ER(@) P$ 3.ST2<.ME D.R"C.R2(27) &*RST2<.ME D.R"C.R2(27) ,EP.RTME<T2*, <'M=ER(@) "o!+are t#ese two SG3 state!ents1. SE3E"T ,*ST*<"T de+art!ent2id ,EPT% last2na!e% first2na!e &R4M e!+loyees 4R,ER =5 de+art!ent2idI

2. SE3E"T de+art!ent2id ,EPT% last2na!e% first2na!e &R4M e!+loyees 4R,ER =5 ,EPTI Cow will t#e res lts differ/ Mark for Review (1) Points 4ne of t#e state!ents will ret rn a syntax error. 4ne of t#e state!ents will eli!inate all d +licate ,EP.RTME<T2*, val es. T#ere is no difference in t#e res lt between t#e two state!ents. ()) T#e state!ents will sort on different col !n val es. "orrect. 0?. T#e P3.5ERS table contains t#ese col !nsP3.5ERS T.=3E3.ST2<.ME D.R"C.R2 (2B) &*RST2<.ME D.R"C.R2 (2B) S.3.R5 <'M=ER(?%2) TE.M2*, <'M=ER(1) M.<.KER2*, <'M=ER(@) P4S*T*4<2*, <'M=ER(1) 5o ! st dis+lay t#e +layer na!e% tea! id% and salary for +layers w#ose salary is in t#e range fro! 27BBB t#ro g# 1BBBBB and w#ose tea! id is in t#e range of 12BB t#ro g# 17BB. T#e res lts ! st be sorted by tea! id fro! lowest to #ig#est and t#en f rt#er sorted by salary fro! #ig#est to lowest. ;#ic# state!ent s#o ld yo se to dis+lay t#e desired res lt/ Mark for Review (1) Points SE3E"T last2na!e% first2na!e% tea!2id% salary &R4M +layers ;CERE (salary Q 27BBB 4R salary R 1BBBBB) .<, tea!2id =ET;EE< 12BB .<, 17BB 4R,ER =5 tea!2id% salaryI SE3E"T last2na!e% first2na!e% tea!2id% salary

&R4M +layers ;CERE salary =ET;EE< 27BBB .<, 1BBBBB .<, tea!2id =ET;EE< 12BB .<, 17BB 4R,ER =5 tea!2id% salary ,ES"I ()) SE3E"T last2na!e% first2na!e% tea!2id% salary &R4M +layers ;CERE salary Q 21@@@.@@ .<, salary R 1BBBBB .<, tea!2id =ET;EE< 12BB .<, 17BB 4R,ER =5 tea!2id .S"% salary ,ES"I SE3E"T last2na!e% first2na!e% tea!2id% salary &R4M +layers ;CERE salary =ET;EE< 21@@@.@@ .<, 1BBBBB.B1 .<, tea!2id =ET;EE< 12BB .<, 17BB 4R,ER =5 tea!2id ,ES"% salary ,ES"I

*ncorrectN See Section 1?. 0@. ;#ic# co!+arison condition !eans 83ess T#an or E( al To/8 Mark for Review (1) Points 8H)8 8AR8 8QH8 8RH8 ()) "orrect. 1B. ;#ic# state!ent abo t t#e logical o+erators is tr e/ Mark for Review (1) Points T#e order of o+erator +recedence is .<,% 4R% and <4T. T#e order of o+erator +recedence is .<,% <4T% and 4R.

T#e order of o+erator +recedence is <4T% 4R% and .<,. T#e order of o+erator +recedence is <4T% .<,% and 4R. ()) "orrect. Section 18
41.Which of the following is TRUE regarding the logical AND operator? Mark for Review (1 !oints

TRUE AND TRUE ret"rn #A$%E TRUE AND #A$%E ret"rn TRUE #A$%E AND TRUE ret"rn NU$$ TRUE AND #A$%E ret"rn #A$%E (& 'ncorrect( %ee %ection 1) 42.Which of the following *est descri*es the +eaning of the $',E operator?

Mark for Review (1 !oints

Displa- rows *ased on a range of val"es( To test for val"es in a list( Match a character pattern( (& To find N"ll val"es( .orrect( 43./o" need to change the defa"lt sort order of the 0RDER 1/ cla"se so that the data is displa-ed in reverse alpha*etical order( Which ke-word sho"ld -o" incl"de in the 0RDER 1/ cla"se?

Mark for Review (1 !oints

DE%. (& A%. %0RT

.2AN3E .orrect( 44.Which cla"se wo"ld -o" incl"de in a %E$E.T state+ent to sort the rows ret"rned *- the $A%T4NAME col"+n?

Mark for Review (1 !oints

0RDER 1/ (& W2ERE #R0M 2A5'N3 .orrect( 45.Eval"ate this %E$E.T state+ent6 %E$E.T last4na+e7 first4na+e7 depart+ent4id7 +anager4id #R0M e+plo-ees8 /o" need to sort data *- +anager id val"es and then alpha*eticall*- e+plo-ee last na+e and first na+e val"es( Which 0RDER 1/ cla"se co"ld -o" "se? 0RDER 1/ depart+ent4id7 last4na+e 0RDER 1/ +anager4id7 last4na+e7 first4na+e (& 0RDER 1/ last4na+e7 first4na+e7 +anager4id 0RDER 1/ +anager4id7 first4na+e7 last4na+e .orrect( 46.Eval"ate this %E$E.T state+ent6 %E$E.T & #R0M e+plo-ees W2ERE salar- 9 :;;;; AND depart+ent4id < 1; 0R e+ail '% N0T NU$$8 Which state+ent is tr"e? The 0R condition will *e eval"ated *efore the AND condition( The AND condition will *e eval"ated *efore the 0R condition( (&

Mark for Review (1 !oints

Mark for Review (1 !oints

The 0R and AND conditions have the sa+e precedence and will *e eval"ated fro+ left to right The 0R and AND conditions have the sa+e precedence and will *e eval"ated fro+ right to left .orrect( 47.Eval"ate this %E$E.T state+ent6 %E$E.T & #R0M e+plo-ees W2ERE depart+ent4id < := 0R depart+ent4id < => 0R depart+ent4id < ?@8 Which operator is the eA"ivalent of the 0R conditions "sed in this %E$E.T state+ent? 'N (& AND $',E 1ETWEEN ((( AND ((( .orrect( 48./o" atte+pt to A"er- the data*ase with this %B$ state+ent6 %E$E.T prod"ct4id C!rod"ct N"+*erC7 categor-4id C.ategor-C7 price C!riceC #R0M prod"cts W2ERE C.ategor-C < >>@; 0RDER 1/ C!rod"ct N"+*erC8 This state+ent fails when eDec"ted( Which cla"se contains a s-ntaD error? %E$E.T prod"ct4id C!rod"ct N"+*erC7 categor-4id C.ategor-C7 price CpriceC 0RDER 1/ C!rod"ct N"+*erC8 #R0M prod"cts W2ERE C.ategor-C < >>@; (& .orrect( 49.Eval"ate this %E$E.T state+ent6

Mark for Review (1 !oints

Mark for Review (1 !oints

Mark for

%E$E.T e+plo-ee4id7 last4na+e7 first4na+e7 salar- E/earl- %alar-E #R0M e+plo-ees W2ERE salar- '% N0T NU$$ 0RDER 1/ last4na+e7 :8 Which cla"se contains an error? %E$E.T e+plo-ee4id7 last4na+e7 first4na+e7 salar- E/earl%alar-E (& #R0M e+plo-ees W2ERE salar- '% N0T NU$$ 0RDER 1/ last4na+e7 :8 .orrect( 50./o" need to create a report to displa- all e+plo-ees that were hired on or after Fan"ar- 17 1GG?( The data sho"ld displa- in this for+at6 E!+loyee Start ,ate and Salary 11?0> 6 S!it# 1B6M.56@2 S 7BBB Which %E$E.T state+ent co"ld -o" "se? %E$E.T e+plo-ee4id HH I HH last4na+e CE+plo-eeC7 hire4date HH J HH salar- C%tart Date and %alar-C #R0M e+plo-ees W2ERE hire4date K< E;1IFANIG?E8 %E$E.T e+plo-ee4id HHE EHH last4na+e CE+plo-eeC7 hire4date HHE EHH salar- C%tart Date and %alar-C #R0M e+plo-ees W2ERE hire4date K< E;1IFANIG?E8 %E$E.T e+plo-ee4id HHECI CHH last4na+e CE+plo-eeC7 hire4date HHC J CHH salar- C%tart Date and %alar-C #R0M e+plo-ees W2ERE hire4date K< E;1IFANIG?E8 %E$E.T e+plo-ee4id HHE I EHH last4na+e EE+plo-eeE7 hire4date HHE J EHH salar- E%tart Date and %alar-E #R0M e+plo-ees W2ERE hire4date K< E;1IFANIG?E8 %E$E.T e+plo-ee4id HHE I EHH last4na+e CE+plo-eeC7 hire4date HHE J EHH salar- C%tart Date and %alar-C #R0M e+plo-ees W2ERE hire4date K< E;1IFANIG?E8 (& .orrect(

Review (1 !oints

Mark for Review (1 !oints