Sunteți pe pagina 1din 24

Part II of the Semester 2 Final Exam covers Sections 10-14 of Database Programming with SQ !

Section 10 1. For a View created using the WITH CHECK OPTION keywords which o! the !o""owing state#ents are true$ "he view will allow the #ser to chec$ it against the %ata %ictionar& Prohibits changing rows not ret#rne% b& the s#b'#er& in the view %efinition! ()* Prohibits D+ actions witho#t a%ministrator ,-E,. a//roval 0llows for DE E"ES from other tables1 incl#%ing ones not liste% in s#b'#er&

%. &ou create a 'iew on the E(P)O&EE* and +EP,-T(ENT* ta."es to dis/"ay sa"ary in!or#ation /er de/art#ent. What wi"" ha//en i! you issue the !o""owing state#ent0 ,2E0"E 32 2EP 0,E 4IE5 sal6%e/t 0S SE E," S7+(e!salar&* sal1 %!%e/artment6name F23+ em/lo&ees e1 %e/artments % 5-E2E e!%e/artment6i% 8 %!%e/artment6i% 9237P :; %!%e/artment6name 32DE2 :; %!%e/artment6name< 0 com/lex view is create% that ret#rns the s#m of salaries /er %e/artment1 sorte% b& %e/artment name! ()* 0 sim/le view is create% that ret#rns the s#m of salaries /er %e/artment1 sorte% b& %e/artment name! 0 com/lex view is create% that ret#rns the s#m of salaries /er %e/artment1 sorte% b& %e/artment i%! =othing1 as the statement constains an error an% will fail!

1. &ou ad#inister an Orac"e data.ase. 2ack #anages the *a"es de/art#ent. He and his e#/"oyees o!ten !ind it necessary to 3uery the data.ase to identi!y custo#ers and their orders. He has asked you to create a 'iew that wi"" si#/"i!y this /rocedure !or hi#se"! and his sta!!. The 'iew shou"d not acce/t IN*E-T 4P+,TE or +E)ETE o/erations. Which o! the !o""owing state#ents shou"d you issue$ ,2E0"E 4IE5 sales6view 0S (SE E," com/an&name1 cit&1 or%eri%1 or%er%ate1 total F23+ c#stomers1 or%ers 5-E2E c#sti% 8 c#sti%* 5I"- 2E0D 3= ;< ,2E0"E 4IE5 sales6view (SE E," c!com/an&name1 c!cit&1 o!or%eri%1 o! or%er%ate1 o!total F23+ c#stomers c1 or%ers o 5-E2E c!c#sti% 8 o!c#sti%* 5I"- 2E0D 3= ;< ,2E0"E 4IE5 sales6view 0S (SE E," c!com/an&name1 c!cit&1 o!or%eri%1 o! or%er%ate1 o!total F23+ c#stomers c1 or%ers o 1

5-E2E c!c#sti% 8 o!c#sti%*< ,2E0"E 4IE5 sales6view 0S (SE E," c!com/an&name1 c!cit&1 o!or%eri%1 o! or%er%ate1 o!total F23+ c#stomers c1 or%ers o 5-E2E c!c#sti% 8 o!c#sti%* 5I"- 2E0D 3= ;< ()*

5. Which state#ent a.out /er!or#ing +() o/erations on a 'iew is true$ ;o# can /erform D+ o/erations on sim/le views! ()* ;o# cannot /erform D+ o/erations on a view that contains the 5I"- ,-E,. 3P"I3= cla#se! ;o# can /erform D+ o/erations on a view that contains the 5I"- 2E0D 3= ; o/tion! ;o# can /erform D+ o/erations on a view that contains col#mns %efine% b& ex/ressions ( ,3S" > 1*!

6. What is the /ur/ose o! inc"uding the WITH CHECK OPTION c"ause when creating a 'iew$ "o ma$e s#re that the /arent table(s* act#all& exist "o $ee/ views form being '#erie% b& #na#thori?e% /ersons "o ma$e s#re that %ata is not %#/licate% in the view "o ma$e s#re no rows are #/%ate% thro#gh the view that will hin%er those rows from being ret#rne% b& the view! ()* 7. &ou cannot insert data through a 'iew i! the 'iew inc"udes 888888. 0 5-E2E cla#se 0 @oin 0 col#mn alias 0 9237P :; cla#se ()*

9. &ou need to create a new 'iew on the E(P)O&EE* ta."e to u/date sa"ary in!or#ation !or e#/"oyees in +e/art#ent 6:. &ou need to ensure that +() o/erations through the 'iew do not change the resu"t set o! the 'iew. Which c"ause shou"d inc"ude in the C-E,TE VIEW state#ent$ F32,E 32 2EP 0,E 5I"- 2E0D 3= ; 5I"- ,-E,. 3P"I3= ()* ;. , 'iew can .e used to kee/ a history record o! o"d data !ro# the under"ying ta."es so e'en i! a row is de"eted !ro# a ta."e you can sti"" se"ect the row through the 'iew. True or Fa"se$ 2

"r#e False ()* <. Views #ust .e used to se"ect data !ro# a ta."e. ,s soon as a 'iew is created on a ta."e you can no "onger se"ect direct"y !ro# the ta."e. True or Fa"se$ "r#e False ()*

1:. Which keyword=s> wou"d you inc"ude in a C-E,TE VIEW state#ent to create the 'iew regard"ess o! whether or not the .ase ta."e e?ists$ F32,E ()* =3F32,E 32 2EP 0,E 5I"- 2E0D 3= ;

11. Which o! the !o""owing keywords cannot .e used when creating a 'iew$ -04I=9 5-E2E 32DE2 :; "he& are all vali% $e&wor%s when creating views! ()*

1%. Which state#ent wou"d you use to a"ter a 'iew$ 0 "E2 4IE5 +3DIF; 4IE5 0 "E2 "0: E ,2E0"E 32 2EP 0,E 4IE5 ()*

11. Which o! the !o""owing state#ents is a 'a"id reason !or using a 'iew$ 4iews allow access to the %ata beca#se the view %is/la&s all of the col#mns from the table! 4iews /rovi%e %ata in%e/en%ence for infre'#ent #sers an% a//lication /rograms! 3ne view can be #se% to retrieve %ata from several tables! 4iews can be #se% to /rovi%e %ata sec#rit&! ()* 3

4iews are #se% when &o# onl& want to restrict D+ o/erations #sing a 5I"- ,-E,. 3P"I3=! 4iews are not vali% #nless &o# have more than one #ser! 15. E'a"uate this 'iew de!inition0 ,2E0"E 32 2EP 0,E 4IE5 /art6name6v 0S SE E," DIS"I=," /art6name F23+ /arts 5-E2E cost A8 4B< Which o! the !o""owing state#ents using the P,-T8N,(E8V 'iew wi"" e?ecute success!u""y$ SE E," ) F23+ /art6name6v< ()* 7PD0"E /art6name6v SE" cost 8 cost ) 1!2C 5-E2E /art6i% 8 BDEE0< DE E"E F23+ /art6name6v 5-E2E /art6i% 8 BDFEG< I=SE2" I="3 /art6name6v (/art6i%1 /art6name1 /ro%#ct6i%1 cost* 40 7ES (FBGEFD1 Hc&lin%erH1 FGE01 C!4B*< 16. E'a"uate this C-E,TE VIEW state#ent0 ,2E0"E 4IE5 /t6view 0S (SE E," first6name1 last6name1 stat#s1 co#rsei%1 s#b@ect1 term F23+ fac#lt& f1 co#rse c 5-E2E f!fac#lt&i% 8 c!fac#lt&i%*< Which ty/e o! 'iew wi"" this state#ent create$ =este% Sim/le Inline ,om/lex ()*

17. E'a"uate this *E)ECT state#ent0 SE E," 235=7+ I2an$I1 c#stomer6i%1 new6balance F23+ (SE E," c#stomer6i%1 new6balance F23+ c#stomer6finance 32DE2 :; new6balance DES,* 5-E2E 235=7+ J8 2B< Which ty/e o! 3uery is this *E)ECT state#ent$ 0 "o/-n '#er& ()* 0 com/lex view 0 sim/le view 0 hierarchical view 4

19. E'a"uate this C-E,TE VIEW state#ent0 ,2E0"E 4IE5 sales6view 0S SE E," c#stomer6i%1 region1 S7+(sales6amo#nt* F23+ sales 5-E2E region I= (101 201 C01 40* 9237P :; region1 c#stomer6i%< Which state#ent is true$ ;o# can mo%if& %ata in the S0 ES table #sing the S0 ES64IE5 view! ;o# cannot mo%if& %ata in the S0 ES table #sing the S0 ES64IE5 view! ()* ;o# can onl& insert recor%s into the S0 ES table #sing the S0 ES64IE5 view! "he ,2E0"E 4IE5 statement generates an error!

1;. &ou #ust create a 'iew that when 3ueried wi"" dis/"ay the na#e custo#er identi!ication nu#.er new .a"ance !inance charge and credit "i#it o! a"" custo#ers. &ou issue this state#ent0 ,2E0"E 32 2EP 0,E 4IE5 ,7S"6,2EDI"64 0S SE E," c!last6name1 c!c#stomer6i%1 a!new6balance1 a!finance6charge1 a!cre%it6limit F23+ c#stomers c1 acco#nts a 5-E2E c!acco#nt6i% 8 a!acco#nt6i% 5I"- 2E0D 3= ;< Which ty/e o! *@) co##and can .e issued on the C4*T8C-E+IT8V 'iew$ 7PD0"E DE E"E I=SE2" SE E," ()*

1<. The E(P8HI*T8V 'iew is no "onger needed. Which state#ent shou"d you use to the re#o'e this 'iew$ D23P em/6hist6v< DE E"E em/6hist6v< 2E+34E em/6hist6v< D23P 4IE5 em/6hist6v< ()*

%:. The C4*TO(E-8FIN,NCE ta."e contains these co"u#ns0 ,7S"3+E26ID =7+:E2(E* =E56:0 0=,E =7+:E2(G12* P2E46:0 0=,E =7+:E2(G12* P0;+E="S =7+:E2(G12* FI=0=,E6,-029E =7+:E2(G12* ,2EDI"6 I+I" =7+:E2(G* &ou created a To/An 3uery re/ort that dis/"ays the account nu#.ers and new .a"ance o! the ;:: accounts that ha'e the highest new .a"ance 'a"ue. The resu"ts are sorted .y /ay#ents 'a"ue !ro# highest to "owest. Which *E)ECT state#ent c"ause is inc"uded in your 3uery$ Inner '#er&K 32DE2 :; new6balance DES, ()* 5

Inner '#er&K 5-E2E 235=7+ 8 F00 3#ter '#er&K 32DE2 :; new6balance DES, Inner '#er&K SE E," c#stomer6i%1 new6balance 235=7+

%1. ,s user 2u"ie you issue this state#ent0 ,2E0"E S;=3=;+ em/ F32 sam!em/lo&ees< Which task was acco#/"ished .y this state#ent$ ;o# create% a /#blic s&non&m on the E+P table owne% b& #ser Sam! ;o# create% a /rivate s&non&m on the E+P 3;EES table that &o# own! ;o# create% a /#blic s&non&m on the E+P 3;EES table owne% b& #ser Sam! ;o# create% a /rivate s&non&m on the E+P 3;EES table owne% b& #ser Sam! ()*

%%. Which state#ent wou"d you use to re#o'e the ),*T8N,(E8I+B inde? on the ),*T8N,(E co"u#n o! the E(P)O&EE* ta."e$ D23P I=DEL last6name6i%x< ()* D23P I=DEL last6name6i%x(last6name*< D23P I=DEL last6name6i%x(em/lo&ees!last6name*< 0 "E2 "0: E em/lo&ees D23P I=DEL last6name6i%x<

%1. What wou"d you create to #ake the !o""owing state#ent e?ecute !aster$ SE E," ) F23+ em/lo&ees 5-E2E 35E2(last6name* 8 HchangH< 0 s&non&m! 0n in%ex1 either a normal or a f#nction6base% in%ex! ()* 0 com/osite in%ex! =othing< the /erformance of this statement cannot be im/rove%!

%5. &ou need to deter#ine the ta."e na#e and co"u#n na#e=s> on which the *,)E*8I+B inde? is de!ined. Which data dictionary 'iew wou"d you 3uery$ 7SE26I=DELES 7SE26"0: ES 7SE263:ME,"S 6

7SE26I=D6,3 7+=S ()* %6. Which state#ent a.out an inde? is true$ 0n in%ex can onl& be create% on a single table col#mn! ,reating an in%ex will alwa&s im/rove '#er& /erformance! ,reating an in%ex reor%ers the %ata in the #n%erl&ing table! 0n in%ex create% on m#lti/le col#mns is calle% a com/osite or concatenate% in%ex! ()* %7. Carry creates a ta."e na#ed INVENTO-&. Pa# #ust .e a."e to 3uery the ta."e. Carry wants to ena."e Pa# to 3uery the ta."e without .eing re3uired to s/eci!y the ta."eDs sche#a. Which o! the !o""owing shou"d Carry create$ 0 schema 0n in%ex 0 view 0 s&non&m ()*

%9. 4ni3ue inde?es are auto#atica""y created on co"u#ns that ha'e which two ty/es o! constraints$ =3" =7 an% 7=IQ7E

7=IQ7E an% P2I+02; .E; ()* 7=IQ7E an% F32EI9= .E; P2I+02; .E; an% F32EI9= .E;

%;. The C4*TO(E-* ta."e e?ists in user (aryDs sche#a. Which state#ent shou"d you use to create a synony# !or a"" data.ase users on the C4*TO(E-* ta."e$ ,2E0"E P7: I, S;=3=;+ c#st 3= mar&!c#stomers< ,2E0"E P7: I, S;=3=;+ c#st F32 mar&!c#stomers< ()* ,2E0"E S;=3=;+ c#st 3= mar&!c#stomers F32 P7: I,< ,2E0"E S;=3=;+ c#st 3= mar&!c#stomers< 920=" SE E," 3= c#st "3 P7: I,< %<. The E(P)O&EE* ta."e contains these co"u#ns0 E+P 3;EE6ID =7+:E2 =3" =7 1 Primar& .e& 0S"6=0+E 402,-022 (20* FI2S"6=0+E 402,-022 (20* DEP02"+E="6ID =7+:E2 Foreign .e& to P23D7,"6ID col#mn of the P23D7," table -I2E6D0"E D0"E DEF07 " S;SD0"E S0 02; =7+:E2 (F12* =3" =7 7

On which co"u#n is an inde? auto#atica""y created !or the E(P)O&EE* ta."e$ S0 02; 0S"6=0+E -I2E6D0"E E+P 3;EE6ID ()* DEP02"+E="6ID 1:. E'a"uate this state#ent0 ,2E0"E I=DEL sales6i%x 3= oe!sales (stat#s*< Which state#ent is true$ "he ,2E0"E I=DEL creates a f#nction-base% in%ex! "he ,2E0"E I=DEL statement creates a non#ni'#e in%ex! ()* "he ,2E0"E I=DEL statement creates a #ni'#e in%ex! "he ,2E0"E I=DEL statement fails beca#se of a s&ntax error!

11. E'a"uate this state#ent0 D23P SEQ7E=,E line6item6i%6se'< What does this state#ent acco#/"ish$ It sets the next val#e of the se'#ence to 1! It sets the next val#e of the se'#ence to 0! It sets the c#rrent val#e of the se'#ence to 0! It removes the se'#ence from the %ata %ictionar&! ()*

1%. E'a"uate this C-E,TE *E@4ENCE state#ent0 ,2E0"E SEQ7E=,E or%er6i%6se' =3,;, E =3,0,-E< Which state#ent is true$ "he se'#ence has no maxim#m val#e! "he se'#ence /reallocates val#es an% retains them in memor&! "he se'#ence will contin#e to generate val#es after reaching its maxim#m val#e! "he se'#ence will start with 1! ()*

11. Which state#ent wou"d you use to re#o'e the E(P8I+8*E@ se3uence$ DE E"E SEQ7E=,E em/6i%6se'< 8

D23P SEQ7E=,E em/6i%6se'< ()* 0 "E2 SEQ7E=,E em/6i%6se' !!!< 2E+34E SEQ7E=,E em/6i%6se'< 15. *e3uences can .e used to0 =Choose three> Ens#re /rimar& $e& val#es will be #ni'#e an% consec#tive Ens#re /rimar& $e& val#es will be #ni'#e even tho#gh ga/s ma& exist ()* 9enerate a range of n#mbers an% o/tionall& c&cle thro#gh them again ()* Set a fixe% interval between s#ccessivel& generate% n#mbers! ()* 9#arantee that no /rimar& $e& val#es are #n#se%

16. &ou create a se3uence with the !o""owing state#ent0 ,2E0"E SEQ7E=,E m&6em/6se'< Which o! the !o""owing state#ents a.out this se3uence are true$ =Choose two> +I=40 7E is e'#al to 1! ()* +0L40 7E is #nlimite%! 5hen the se'#ence excee%s its maxim#m val#e it will contin#e to generate n#mbers starting with +I=40 7E! "he se'#ence will not cache a range of n#mbers in memor&! ()* 17. Which o! the !o""owing /ri'i"eges #ust .e assigned to a user account in order !or that user to connect to an Orac"e data.ase$ 0 "E2 SESSI3= ,2E0"E SESSI3= ()* 3PE= SESSI3= 2ES"2I,"ED SESSI3=

19. Which o! the !o""owing .est descri.es a ro"e in an Orac"e data.ase$ 0 role is a t&/e of s&stem /rivilege! 0 role is the /art that a #ser /la&s in '#er&ing the %atabase! 0 role is a name for a gro#/ of /rivileges! ()* 0 role is an ob@ect /rivilege which allows a #ser to #/%ate a table!

1;. 4ser 2,(E* has created a C4*TO(E-* ta."e and wants to a""ow a"" other users to *E)ECT !ro# it. Which co##and shou"d 2,(E* use to do this$ 920=" c#stomers(SE E,"* "3 P7: I,< 920=" SE E," 3= c#stomers "3 0 < 920=" SE E," 3= c#stomers "3 P7: I,< ()* ,2E0"E P7: I, S;=3=;+ c#stomers F32 @ames!c#stomers< 1<. &ou want to grant /ri'i"eges to user CH,N that wi"" a""ow CH,N to u/date the data in the E(P)O&EE* ta."e. Which ty/e o! /ri'i"eges wi"" you grant to CH,N$ 7ser /rivileges 3b@ect /rivileges ()* S&stem /rivileges 0%ministrator /rivileges

5:. &ou create a 'iew na#ed E(P)O&EE*8VIEW on a su.set o! the E(P)O&EE* ta."e. 4ser ,4+-E& needs to use this 'iew to create re/orts. On"y you and ,udrey shou"d ha'e access to this 'iew. Which o! the !o""owing actions shou"d you /er!or#$ Do nothing! 0s a %atabase #ser1 0#%re&Hs #ser acco#nt has a#tomaticall& been grante% the SE E," /rivilege for all %atabase ob@ects! 920=" SE E," 3= em/lo&ees6view "3 /#blic< 920=" SE E," 3= em/lo&ees6view "3 a#%re&< ()* 920=" SE E," 3= em/lo&ees 0=D em/lo&ees6view "3 a#%re&<

51. &ou want to grant user COC the a.i"ity to change other usersD /asswords. Which /ri'i"ege shou"d you grant to COC$ "he 0 "E2 7SE2 /rivilege ()* "he ,2E0"E 7SE2 /rivilege "he D23P 7SE2 /rivilege "he ,2E0"E P23FI E /rivilege

5%. The data.ase ad#inistrator wants to a""ow user (arco to create new ta."es in his own sche#a. Which /ri'i"ege shou"d .e granted to (arco$ ,2E0"E 0=; "0: E SE E," 10

,2E0"E "0: E ()* ,2E0"E 3:ME,"

51. Which state#ent wou"d you use to re#o'e an o.Eect /ri'i"ege granted to a user$ 0 "E2 7SE2 2E43.E ()* 2E+34E D23P 55. When granting an o.Eect /ri'i"ege which o/tion wou"d you inc"ude to a""ow the grantee to grant the /ri'i"ege to another user$ 5I"- 920=" 3P"I3= ()* 5I"- 0D+I= 3P"I3= P7: I, F32,E

56. Which state#ent wou"d you use to grant a ro"e to users$ 920=" ()* 0 "E2 7SE2 ,2E0"E 7SE2 0SSI9=

57. Which state#ent wou"d you use to add /ri'i"eges to a ro"e$ ,2E0"E 23 E 0 "E2 23 E 920=" ()* 0SSI9=

59. Which o! the !o""owing si#/"i!ies the ad#inistration o! /ri'i"eges$ 0n in%ex 0 view 11

0 trigger 0 role ()*

5;. To Eoin a ta."e in your data.ase to a ta."e on a second =re#ote> Orac"e data.ase you need to use0 0 remote /roce%#re call 0n 3racle gatewa& /ro%#ct 0n 3D:, %river 0 %atabase lin$ ()* 5<. Which *@) state#ent is used to re#o'e a"" the changes #ade .y an unco##itted transaction$ 7=D3< 23 23 :0,.< ()* :0,. "3 S04EP3I="<

2E43.E !!!<

6:. I! a data.ase crashes a"" unco##itted changes are auto#atica""y ro""ed .ack. True or Fa"se$ "r#e ()* False

1. In order to 3uery a data.ase using a 'iew which o! the !o""owing state#ents a//"ies$ 7se s/ecial 4IE5 SE E," $e&wor%s! ;o# can retrieve %ata from a view as &o# wo#l% from an& table! ()* ;o# can never see all the rows in the table thro#gh the view! "he tables &o# are selecting from can be em/t&1 &et the view still ret#rns the original %ata from those tables!

1. Which state#ent a.out the C-E,TE VIEW state#ent is true$ 0 ,2E0"E 4IE5 statement ,0= contain a @oin '#er&! ()* 0 ,2E0"E 4IE5 statement ,0==3" contain an 32DE2 :; cla#se! 0 ,2E0"E 4IE5 statement ,0==3" contain a f#nction! 0 ,2E0"E 4IE5 statement ,0==3" contain a 9237P :; cla#se! 12

6. The F,C4)T& ta."e contains these co"u#ns0 F0,7 ";ID 402,-022(B* =3" =7 P2I+02; .E; FI2S"6=0+E 402,-022(20* 0S"6=0+E 402,-022(20* 0DD2ESS 402,-022(CB* ,I"; 402,-022(1B* S"0"E 402,-022(2* NIP =7+:E2(E* "E EP-3=E =7+:E2(10* S"0"7S 402,-022(2* =3" =7 "he ,372SE table contains these col#mnsK ,372SEID 402,-022(B* =3" =7 P2I+02; .E; S7:ME," 402,-022(B* "E2+ 402,-022(D* F0,7 ";ID 402,-022(B* =3" =7 F32EI9= .E; &ou ha'e .een asked to co#/i"e a re/ort that identi!ies a"" adEunct /ro!essors who wi"" .e teaching c"asses in the u/co#ing ter#. &ou want to create a 'iew that wi"" si#/"i!y the creation o! this re/ort. Which C-E,TE VIEW state#ents wi"" acco#/"ish this task$ ,2E0"E 4IE5 (SE E," first6name1 last6name1 stat#s1 co#rsei%1 s#b@ect1 term F23+ fac#lt&1 co#rse 5-E2E fac#lt&i% 8 fac#lt&i%*< ,2E0"E 4IE5 /t6view 3= (SE E," first6name1 last6name1 stat#s1 co#rsei%1 s#b@ect1 term F23+ fac#lt& f an% co#rse c 5-E2E f!fac#lt&i% 8 c!fac#lt&i%*< ,2E0"E 4IE5 /t6view I= (SE E," first6name1 last6name1 stat#s1 co#rsei%1 s#b@ect1 term F23+ fac#lt& co#rse*< ,2E0"E 4IE5 /t6view 0S (SE E," first6name1 last6name1 stat#s1 co#rsei%1 s#b@ect1 term F23+ fac#lt& f1 co#rse c 5-E2E f!fac#lt&i% 8 c!fac#lt&i%*< ()*

7. E'a"uate this C-E,TE VIEW state#ent0 ,2E0"E 4IE5 em/6view 0S SE E," S7+(salar&* F23+ em/lo&ees< Which state#ent is true$ ;o# cannot #/%ate %ata in the E+P 3;EES table #sing the E+P64IE5 view! ()* ;o# can #/%ate an& %ata in the E+P 3;EES table #sing the E+P64IE5 view! ;o# can %elete recor%s from the E+P 3;EES table #sing the E+P64IE5 view! ;o# can #/%ate onl& the S0 02; col#mn in the E+P 3;EES table #sing the E+P64IE5 view!

<. &ou cannot #odi!y data in a 'iew i! the 'iew contains 888888. 13

"he DIS"I=," $e&wor% ()* 0 5-E2E cla#se 0 s#b'#er& in the F23+ cla#se "he 5I"- ,-E,. 3P"I3= cla#se

1:. &ou can create a 'iew i! the 'iew su.3uery contains an in"ine 'iew. True or Fa"se$ Prav%a ()* =e/rav%a 11. Which o/tion wou"d you use when creating a 'iew to ensure that no +() o/erations occur on the 'iew$ F32,E =3F32,E 5I"- 2E0D 3= ; ()* 5I"- 0D+I= 3P"I3=

11. Which action can .e /er!or#ed .y using +() state#ents$ Deleting recor%s in a table ()* ,reating P2I+02; .E; constraints Disabling an in%ex 0ltering a table

16. &ou want to create a 'iew .ased on the *,)E*-EP ta."e. &ou /"an to grant access to this 'iew to #e#.ers o! the *a"es de/art#ent. &ou want *a"es e#/"oyees to .e a."e to u/date the *,)E*-EP ta."e through the 'iew which you /"an to na#e *,)E*-EP8VIEW. What shou"d not .e s/eci!ied in your C-E,TE VIEW state#ent$ "he 0S $e&wor% 0 5-E2E cla#se "he I= $e&wor% 0 9237P :; cla#se ()*

1;. The C4*TO(E-8FIN,NCE ta."e contains these co"u#ns0 14

,7S"3+E26ID =7+:E2(E* =E56:0 0=,E =7+:E2(G12* P2E46:0 0=,E =7+:E2(G12* P0;+E="S =7+:E2(G12* FI=0=,E6,-029E =7+:E2(G12* ,2EDI"6 I+I" =7+:E2(G* &ou e?ecute this state#ent0 SE E," 235=7+ I2an$I1 c#stomer6i%1 new6balance F23+ (SE E," c#stomer6i%1 new6balance F23+ c#stomer6finance* 5-E2E 235=7+ J8 2B 32DE2 :; new6balance DES,< What state#ent is true$ "he statement faile% to exec#te beca#se an inline view was #se%! "he statement will not necessaril& ret#rn the 2B highest new balance val#es1 as the inline view has no 32DE2 :;! ()* "he 2B greatest new balance val#es were %is/la&e% from the highest to the lowest! "he statement faile% to exec#te beca#se the 32DE2 :; %oes =3" #se the "o/-n col#mn! 1<. The E(P)O&EE* ta."e contains these co"u#ns0 E+P 3;EE6ID =7+:E2 0S"6=0+E 402,-022(2B* FI2S"6=0+E 402,-022(2B* DEP02"+E="6ID =7+:E2 M3:6ID =7+:E2 +0=09E26ID =7+:E2 S0 02; =7+:E2(E12* ,3++ISS3I= =7+:E2(G12* -I2E6D0"E D0"E Which *E)ECT state#ent cou"d .e used to dis/"ay the 1: "owest /aid c"erks that .e"ong to de/art#ent 9:$ SE E," 235=7+ I2an$ingI1 last6nameOOH 1HOOfirst6name IEm/lo&eeI1 salar& ISalar&I F23+ (SE E," last6name1 first6name1 salar& F23+ em/lo&ees 32DE2 :; salar&* 5-E2E 235=7+ J810 0=D @ob6i% I.E H, E2.H 0=D %e/artment6i% 8 G0< SE E," 235=7+ I2an$ingI1last6nameOOH1HOOfirst6name IEm/lo&eeI1 salar& ISalar&I F23+ (SE E," last6name1 first6name1 salar&1 @ob6i% F23+ em/lo&ees 5-E2E @ob6i% I.E H, E2.H 0=D %e/artment6i% 8 G0 32DE2 :; salar&* 5-E2E 235=7+ J810< ()* SE E," 235=7+ I2an$ingI1 last6nameOOH 1HOOfirst6name IEm/lo&eeI1 salar& ISalar&I F23+ (SE E," last6name1 first6name1 salar&1 @ob6i%1 %e/t6i% F23+ em/lo&ees 5-E2E 235=7+ J810 32DE2 :; salar&* 5-E2E @ob6i% I.E H, E2.H 0=D %e/artment6i% 8 G0< "he onl& wa& is to #se the %ata %ictionar&!

%:. , so!tware 'eri!ication and 'a"idation #ethod. Software engineering 7nit testing ()* Pro%#ction Doc#mentation 15

%1. None3uiEoins are nor#a""y used with which o! the !o""owing$ =Choose two> 2anges of n#mbers ()* 2anges of text 2anges of %ates ()* 2anges of rowi%s ranges of col#mns %%. Which state#ent a.out outer Eoins is true$ "he tables m#st be aliase%! "he F7 1 2I9-"1 or EF" $e&wor% m#st be incl#%e%! "he 32 o/erator cannot be #se% to lin$ o#ter @oin con%itions! ()* 3#ter @oins are alwa&s eval#ate% before other t&/es of @oins in the '#er&!

%1. 4sing Orac"e Pro/rietary Eoin synta? which two o/erators can .e used in an outer Eoin condition using the outer Eoin o/erator =F>$ 0=D an% 8 ()* 32 an% 8 :E"5EE=!!!0=D!!! an% I= I= an% 8

%5. What is the #ini#u# nu#.er o! Eoin conditions re3uired to Eoin 6 ta."es together$ C 4 ()* B 3ne more than the n#mber of tables %6. When Eoining 1 ta."es in a *E)ECT state#ent how #any Eoin conditions are needed in the WHE-E c"ause$ 0 1 2 ()* C

%7. What ha//ens when you create a Cartesian /roduct$ 0ll rows from one table are @oine% to all rows of another table ()* "he table is @oine% to itself1 one col#mn to the next col#mn1 exha#sting all /ossibilities "he table is @oine% to another e'#al table 16

0ll rows that %o not match in the 5-E2E cla#se are %is/la&e% %9. &ou need to /ro'ide a "ist o! the !irst and "ast na#es o! a"" e#/"oyees who work in the *a"es de/art#ent who earned a .onus and had sa"es o'er G6: :::. The co#/any /resident wou"d "ike the sa"es "isted starting with the highest a#ount !irst. The E(P)O&EE* ta."e and the *,)E*8+EPT ta."e contain the !o""owing co"u#ns0 E+P 3;EES E+P6ID =7+:E2(10* P2I+02; .E; 0S"6=0+E 402,-022(20* FI2S"6=0+E 402,-022(20* DEP"02"+E="6ID 402,-022(20* -I2E6D0"E D0"E S0 02; =7+:E2(10* S0 ES6DEP" S0 ES6ID =7+:E2(10* P2I+02; .E; S0 ES =7+:E2(20* Q73"0 =7+:E2(20* +0=09E2 402,-022(C0* :3=7S =7+:E2(10* E+P 3;EE6ID =7+:E2(10* F32EI9= .E; Which *E)ECT state#ent wi"" acco#/"ish this task$ SE E," e!em/lo&ee6i%1 e!last6name1 e!first6name1 s!em/lo&ee6i%1 s!bon#s1 s!sales F23+ em/lo&ees e1 sales6%e/t s 32DE2 :; sales DES, 5-E2E e!em/lo&ee6i% 8 s!em/lo&ee6i% 0=D sales A B0000 0=D s!bon#s IS =3" =7 < SE E," e!em/lo&ee6i%1 e!last6name1 e!first6name1 s!em/lo&ee6i%1 s!bon#s1 s! sales 32DE2 :; sales DES, F23+ em/lo&ees e1 sales6%e/t s 5-E2E e!em/lo&ee6i% 8 s!em/lo&ee6i% 0=D s!bon#s IS =3" =7 0=D sales A B0000< SE E," e!em/lo&ee6i%1 e!last6name1 e!first6name1 s!em/lo&ee6i%1 s!bon#s1 s! sales 5-E2E e!em/lo&ee6i% 8 s!em/lo&ee6i% F23+ em/lo&ees e1 sales6%e/t s 0=D s!bon#s IS =3" =7 0=D sales A B0000 32DE2 :; sales DES,< SE E," e!em/lo&ee6i%1 e!last6name1 e!first6name1 s!em/lo&ee6i%1 s!bon#s1 s! sales F23+ em/lo&ees e1 sales6%e/t s 5-E2E e!em/lo&ee6i% 8 s!em/lo&ee6i% 0=D s!bon#s IS =3" =7 0=D sales A B0000 32DE2 :; sales DES,< ()*

%;. , transaction #akes se'era" successi'e changes to a ta."e. I! re3uired you want to .e a."e to ro"".ack the "ater changes whi"e kee/ing the ear"ier changes. What #ust you inc"ude in your code to do this$ 0n #/%ate statement 0 save/oint ()* 17

0n ob@ect /rivilege 0 %atabase lin$ 0 se'#ence %<. Which *@) state#ent is used to re#o'e a"" the changes #ade .y an unco##itted transaction$ 7=D3< 23 23 :0,.< ()* :0,. "3 S04EP3I="<

2E43.E!!!<

1:. 4ser Kate wants to create inde?es on ta."es in her sche#a. What /ri'i"ege #ust .e granted to Kate so that she can do this$ ,2E0"E I=DEL ,2E0"E 0=; I=DEL 0 "E2 "0: E =one< #sers %o not nee% extra /rivileges to create in%exes on tables in their own schema ()* 11. &ou grant user ,(& the C-E,TE *E**ION /ri'i"ege. Which ty/e o! /ri'i"ege ha'e you granted to ,(&$ 0 s&stem /rivilege ()* 0n ob@ect /rivilege 0 #ser /rivilege 0n access /rivilege

15. 4ser CH,NH has .een granted *E)ECT 4P+,TE IN*E-T and +E)ETE /ri'i"eges on the E(P)O&EE* ta."e. &ou now want to /re'ent Chang !ro# adding or de"eting rows !ro# the ta."e whi"e sti"" a""owing hi# to read and #odi!y e?isting rows. Which state#ent shou"d you use to do this$ 2E43.E 0 3= em/lo&ees F23+ chang<

2E43.E I=SE2"1 DE E"E 3= em/lo&ees F23+ chang< ()* 2E+34E I=SE2"1 DE E"E 3= em/lo&ees F23+ chang< 2E43.E I=SE2" 0=D DE E"E 3= em/lo&ees F23+ chang<

16. Parenthesis are not used to identi!y the su. e?/ressions within the e?/ression. True or Fa"se$ "r#e 18

False ()* 17. Which o! these *@) !unctions used to #ani/u"ate strings is not a 'a"id regu"ar e?/ression !unction $ 2E9ELP62EP 0,E 2E9ELP6 I.E 2E9ELP ()* 2E9ELP6S7:S"2

19. -egu"ar e?/ressions are a #ethod o! descri.ing .oth si#/"e and co#/"e? /atterns !or searching and #ani/u"ating. True or Fa"se$ "r#e ()* False

51. Hranting an o.Eect /ri'i"ege WITH H-,NT OPTION a""ows the reci/ient to grant other o.Eect /ri'i"eges on the ta."e to other users. True or Fa"se$ Prav%a =e/rav%a ()* 5%. 4ser C-,IH creates a 'iew na#ed INVENTO-&8V which is .ased on the INVENTO-& ta."e. C-,IH wants to #ake this 'iew a'ai"a."e !or 3uerying to a"" data.ase users. Which o! the !o""owing actions shou"d C-,IH /er!or#$ -e is not re'#ire% to ta$e an& action beca#se1 b& %efa#lt1 all %atabase #sers can a#tomaticall& access views! -e sho#l% assign the SE E," /rivilege to all %atabase #sers for the I=4E="32; table! -e sho#l% assign the SE E," /rivilege to all %atabase #sers for I=4E="32;64 view! ()* -e m#st grant each #ser the SE E," /rivilege on both the I=4E="32; table an% I=4E="32;64 view!

51. Which o! the !o""owing .est descri.es the /ur/ose o! the -EFE-ENCE* o.Eect /ri'i"ege on a ta."e$ It allows a #serHs session to rea% from the table b#t onl& so that foreign $e& constraints can be chec$e%! ()* It allows a #ser to refer to the table in a SE E," statement! It allows a #ser to create foreign $e& constraints on the table! It allows the #ser to create new tables which contain the same %ata as the reference% table! 19

55. E'a"uate this C-E,TE *E@4ENCE state#ent0 ,2E0"E SEQ7E=,E line6item6i%6se' I=,2E+E=" :; -1< Which state#ent is true$ "he statement will not exec#te s#ccessf#ll&! "he se'#ence will generate se'#ential %escen%ing val#es! ()* "he starting val#e of the I=E6I"E+6ID6SEQ se'#ence will b& -1! "he minim#m val#e of the I=E6I"E+6ID6SEQ will be the smallest /ossible integer val#e!

57. 4ser (aryDs sche#a contains an E(P ta."e. (ary has +ata.ase ,d#inistrator /ri'i"eges and e?ecutes the !o""owing state#ent0 ,2E0"E P7: I, S;=3=;+ em/ F32 mar&!em/< 4ser *usan now needs to *E)ECT !ro# (aryDs E(P ta."e. Which o! the !o""owing *@) state#ents can she use$ =Choose two> ,2E0"E S;=3=;+ mar&s6em/ F32 mar&(em/*< SE E," ) F23+ em/< ()* SE E," ) F23+ em/!mar&< SE E," ) F23+ mar&!em/< ()*

59. E'a"uate this state#ent0 ,2E0"E P7: I, S;=3=;+ testing F32 chan!testing< Which task wi"" this state#ent acco#/"ish$ It recreates the s&non&m if it alrea%& exists! It forces all #sers to access "ES"I=9 #sing the s&non&m! It allows onl& the #ser ,-0= to access "ES"I=9 #sing the s&non&m! It eliminates the nee% for all #sers to '#alif& "ES"I=9 with its schema! ()*

5;. The !o""owing inde?es e?ist on the E(P)O&EE* ta."e0 0 #ni'#e in%ex on the E+P 3;EE6ID /rimar& $e& col#mn 0 non-#ni'#e in%ex on the M3:6ID col#mn 0 com/osite in%ex on the FI2S"6=0+E an% 0S"6=0+E col#mns! I! the E(P)O&EE* ta."e is dro//ed which inde?es are auto#atica""y dro//ed at the sa#e ti#e$ E+P6ID onl& M3:6ID onl& DEP"6ID onl& E+P6ID an% M3:6ID 20

0ll In%exes ()* 6. Which o! the !o""owing *@) state#ents wi"" dis/"ay the inde? na#e ta."e na#e and the uni3ueness o! the inde? !or a"" inde?es on the E(P)O&EE* ta."e ,2E0"E in%ex6name1 table6name1 #ni'#eness F23+ #ser6in%exes 5-E2E table6name 8 HE+P 3;EESH< SE E," in%ex6name1 table6name1 #ni'#eness F23+ HE+P 3;EESH< SE E," in%ex6name1 table6name1 #ni'#eness F23+ #ser6in%exes 5-E2E table6name 8 HE+P 3;EESH< ()* SE E," in%ex6name1 table6name1 #ni'#eness F23+ #ser6in%exes 5-E2E in%ex 8 E+P 3;EES< 1%. Which o! the !o""owing are o.Eect /ri'i"eges$ (,hoose two* SE E," ()* D23P "0: E ,2E0"E "0: E I=SE2" ()* Section 11 51. &ou need to create a 'iew that when 3ueried wi"" dis/"ay the na#e e#/"oyee identi!ication nu#.er !irst and "ast na#e sa"ary and de/art#ent identi!ication nu#.er. When 3ueried the dis/"ay shou"d .e sorted .y sa"ary !ro# "owest to highest then .y "ast na#e and !irst na#e a"/ha.etica""y. The 'iew de!inition shou"d .e created regard"ess o! the e?istence o! the E(P)O&EE* ta."e. No +() #ay .e /er!or#ed when using this 'iew. E'a"uate these state#ents0 C-E,TE O- -EP),CE NOFO-CE VIEW E(P8*,),-&8V ,* *E)ECT e#/"oyee8id "ast8na#e !irst8na#e sa"ary de/art#ent8id F-O( e#/"oyees WITH -E,+ ON)&I *E)ECT J F-O( e#/8sa"ary8' O-+E- C& sa"ary "ast8na#e !irst8na#eI Which state#ent is true$ 21

5hen both statements are exec#te% all of the %esire% res#lts are achieve%! "he ,2E0"E 4IE5 statement will fail if the E+P 3;EES table %oes not exist! ()* "he statements will =3" ret#rn all of the %esire% res#lts beca#se the 5I"- ,-E,. 3P"I3= cla#se is =3" incl#%e% in the ,2E0"E 4IE5 statement! "o achieve all of the %esire% res#lts this 32DE2 3= cla#se sho#l% be a%%e% to the ,2E0"E 4IE5 statementK H32DE2 3= salar&1 last6name1 first6nameH!

5%. Which state#ent wou"d you use to a"ter a 'iew$ 0 "E2 4IE5 +3DIF; 4IE5 0 "E2 "0: E ,2E0"E 32 2EP 0,E 4IE5 ()*

51. Which keyword=s> wou"d you inc"ude in a C-E,TE VIEW state#ent to create the 'iew regard"ess o! whether or not the .ase ta."e e?ists$ F32,E ()* =3F32,E 32 2EP 0,E 5I"- 2E0D 3= ;

Section 1B (Odpovzte na vechny otzky v tto t!" 55. When Eoining 1 ta."es in a *E)ECT state#ent how #any Eoin conditions are needed in the WHE-E c"ause$ 0 1 2 ()* 22

C 4B! ;o# have two tables name% E+P 3;EES an% S0 ES! ;o# want to i%entif& the sales re/resentatives who have generate% at least P1001000 in reven#e! #h!ch $%e&y ho%'d yo% ! %e( Ozna!t p&o zhodnocen) (1* :o%& SE E," e!first6name1 e!last6name1 s!sales F23+ em/lo&ees e1 sales s 5-E2E e!em/lo&ee6i% 8 s!em/lo&ee6i% 0=D reven#e A 100000< SE E," e!first6name1 e!last6name1 s!sales F23+ em/lo&ees e1 sales s 5-E2E e!em/lo&ee6i% 8 s!em/lo&ee6i% 0=D reven#e A8 100000< ()* SE E," e!first6name1 e!last6name1 s!sales F23+ em/lo&ees1 sales 5-E2E e!em/lo&ee6i% 8 s!em/lo&ee6i% 0=D reven#e A8 100000< SE E," first6name1 last6name1 sales F23+ em/lo&ees e1 sales s 5-E2E e!em/lo&ee6i% 8 s!em/lo&ee6i% 0=D reven#e A 100000< 57. The P,TIENT* and +OCTO-* ta."es contain these co"u#ns0 P,TIENT* P,TIENT8I+ N4(CE-=<> ),*T8N,(E V,-CH,-% =%:> FI-*T8N,(E V,-CH,-% =%:> +OCTO-* +OCTO-8I+ N4(CE-=<> ),*T8N,(E V,-CH,-% =%:> FI-*T8N,(E V,-CH,-% =%:> &ou issue this state#ent0 *E)ECT /atient8id doctor8id F-O( /atients doctorsI Which resu"t wi"" this state#ent /ro'ide$

0 re/ort containing all /ossible combinations of the P0"IE="6ID an% D3,"326ID val#es ()* 0 re/ort containing each /atientHs i% val#e an% their %octorHs i% val#e 0 re/ort with =3 %#/licate P0"IE="6ID or D3,"326ID val#es 0 s&ntax error 23

59. Which state#ent a.out the Eoin synta? o! an Orac"e Pro/rietary Eoin synta? *E)ECT state#ent is true$ "he 3= $e&wor% m#st be incl#%e%! "he M3I= $e&wor% m#st be incl#%e%! "he F23+ cla#se re/resents the @oin criteria! "he 5-E2E cla#se re/resents the @oin criteria! ()* 5;. None3uiEoins are nor#a""y used with which o! the !o""owing$ =Choose two>

2anges of n#mbers ()* 2anges of text 2anges of %ates ()* 2anges of rowi%s ranges of col#mns

5<. Which o! the !o""owing .est descri.es the !unction o! an outer Eoin$ 0n o#ter @oin will ret#rn onl& those rows that %o not meet the @oin criteria! 0n o#ter @oin will ret#rn onl& %ata from the far left col#mn in one table an% the far right col#mn in the other table! 0n o#ter @oin will ret#rn %ata onl& if both tables contain an i%entical /air of col#mns! 0n o#ter @oin will ret#rn all rows that meet the @oin criteria an% will ret#rn =7 if no rows from the other table satisf& the @oin criteria! ()* val#es from one table

6:. Which state#ent a.out outer Eoins is true$ "he tables m#st be aliase%! "he F7 1 2I9-"1 or EF" $e&wor% m#st be incl#%e%!

"he 32 o/erator cannot be #se% to lin$ o#ter @oin con%itions! ()* 3#ter @oins are alwa&s eval#ate% before other t&/es of @oins in the '#er&!

24

S-ar putea să vă placă și