Sei sulla pagina 1di 18

Test: Final Exam Semester 2 - Part II

1. You need to create a new view on the EMP!YEES ta"le to u#date salar$
in%ormation %or em#lo$ees in &e#artment '(. You need to ensure that &M o#erations
throu)h the view do not chan)e the result set o% the view. *hich clause should include in
the +,E-TE .IE* statement/

F!,+E

!, ,EP-+E

*IT0 ,E-& !1Y

*IT0 +0E+2 !PTI!1 345



2. You create a view on the EMP!YEES and &EP-,TME1TS ta"les to dis#la$
salar$ in%ormation #er de#artment. *hat will ha##en i% $ou issue the %ollowin)
statement:
+,E-TE !, ,EP-+E .IE* sal6de#t
-S SEE+T S7M3e.salar$5 sal8 d.de#artment6name
F,!M em#lo$ees e8 de#artments d
*0E,E e.de#artment6id 9 d.de#artment6id
:,!7P ;Y d.de#artment6name
!,&E, ;Y d.de#artment6name<

- com#lex view is created that returns the sum o% salaries #er de#artment8 sorted "$
de#artment name. 345

- sim#le view is created that returns the sum o% salaries #er de#artment8 sorted "$
de#artment name.

- com#lex view is created that returns the sum o% salaries #er de#artment8 sorted "$
de#artment id.

1othin)8 as the statement constains an error and will %ail.




=. *hich o#tion would $ou use when creatin) a view to ensure that no &M o#erations
occur on the view/

F!,+E

1!F!,+E

*IT0 ,E-& !1Y 345

*IT0 -&MI1 !PTI!1


>. You cannot modi%$ data in a view i% the view contains 666666
'.
The &ISTI1+T ?e$word 345

- *0E,E clause

- su"@uer$ in the F,!M clause

The *IT0 +0E+2 !PTI!1 clause


'. *hich o% the %ollowin) is T,7E re)ardin) sim#le views/

The$ derive data %rom man$ ta"les8 so the$ t$#icall$ contain Aoins.

The$ contain %unctions or )rou#s o% data

The$ can #er%orm &M o#erations throu)h the view 345

The$ are not stored in the &ata &ictionar$



B. *hat is the #ur#ose o% includin) the *IT0 +0E+2 !PTI!1 clause when creatin)
a view/

To ma?e sure that the #arent ta"le3s5 actuall$ exist

To ?ee# views %orm "ein) @ueried "$ unauthoriCed #ersons

To ma?e sure that data is not du#licated in the view

To ma?e sure no rows are u#dated throu)h the view that will hinder those rows %rom
"ein) returned "$ the view. 345
D. You administer an !racle data"ase. Eac? mana)es the Sales de#artment. 0e and his
em#lo$ees o%ten %ind it necessar$ to @uer$ the data"ase to identi%$ customers and their
orders. 0e has as?ed $ou to create a view that will sim#li%$ this #rocedure %or himsel%
and his sta%%. The view should not acce#t I1SE,T8 7P&-TE or &EETE o#erations.
*hich o% the %ollowin) statements should $ou issue/

+,E-TE .IE* sales6view
-S 3SEE+T com#an$name8 cit$8 orderid8 orderdate8 total
F,!M customers8 orders
*0E,E custid 9 custid5
*IT0 ,E-& !1Y<


+,E-TE .IE* sales6view
3SEE+T c.com#an$name8 c.cit$8 o.orderid8 o. orderdate8 o.total
F,!M customers c8 orders o
*0E,E c.custid 9 o.custid5
*IT0 ,E-& !1Y<

+,E-TE .IE* sales6view
-S 3SEE+T c.com#an$name8 c.cit$8 o.orderid8 o. orderdate8 o.total
F,!M customers c8 orders o
*0E,E c.custid 9 o.custid5<

+,E-TE .IE* sales6view
-S 3SEE+T c.com#an$name8 c.cit$8 o.orderid8 o. orderdate8 o.total
F,!M customers c8 orders o
*0E,E c.custid 9 o.custid5
*IT0 ,E-& !1Y<

F. Evaluate this +,E-TE .IE* statement:
+,E-TE .IE* #t6view -S
3SEE+T %irst6name8 last6name8 status8 courseid8 su"Aect8 term
F,!M %acult$ %8 course c
*0E,E %.%acult$id 9 c.%acult$id5<
*hich t$#e o% view will this statement create/

1ested

Sim#le

Inline

+om#lex 345

G. *hich statement a"out the +,E-TE .IE* statement is true/

- +,E-TE .IE* statement +-1 contain a Aoin @uer$. 345

- +,E-TE .IE* statement +-11!T contain an !,&E, ;Y clause.

- +,E-TE .IE* statement +-11!T contain a %unction.

- +,E-TE .IE* statement +-11!T contain a :,!7P ;Y clause.


1(. You need to create a view on the S-ES ta"le8 "ut the S-ES ta"le has not $et
"een created. *hich statement is true/
You must create the S-ES ta"le "e%ore creatin) the view.

;$ de%ault8 the view will "e created even i% the S-ES ta"le does not exist.

You can create the ta"le and the view at the same time usin) the F!,+E o#tion.

You can use the F!,+E o#tion to create the view "e%ore the S-ES ta"le has "een
created. 345



11. *hich o#tion would $ou use to modi%$ a view rather than dro##in) it and
recreatin) it/

F!,+E

1!F!,+E

+,E-TE !, ,EP-+E 345

*IT0 -&MI1 !PTI!1


12. *hich statement would $ou use to alter a view/

-TE, .IE*

M!&IFY .IE*

-TE, T-;E

+,E-TE !, ,EP-+E .IE* 345
1=. .iews must "e used to select data %rom a ta"le. -s soon as a view is created on a
ta"le8 $ou can no lon)er select directl$ %rom the ta"le. True or False/

True

False 345





1>. You administer an !racle data"ase8 which contains a ta"le named EMP!YEES.
u?e8 a data"ase user8 must create a re#ort that includes the names and addresses o% all
em#lo$ees. You do not want to )rant u?e access to the EMP!YEES ta"le "ecause it
contains sensitive data. *hich o% the %ollowin) actions should $ou #er%orm %irst/


+reate the re#ort %or him.

+reate a view. 345

+reate a su"@uer$.

+reate an index.





1'. Evaluate this +,E-TE .IE* statement:
+,E-TE .IE* em#6view
-S SEE+T S7M3salar$5
F,!M em#lo$ees<
*hich statement is true/



You cannot u#date data in the EMP!YEES ta"le usin) the EMP6.IE* view. 345

You can u#date an$ data in the EMP!YEES ta"le usin) the EMP6.IE* view.

You can delete records %rom the EMP!YEES ta"le usin) the EMP6.IE* view.

You can u#date onl$ the S--,Y column in the EMP!YEES ta"le usin) the
EMP6.IE* view.
1B. The +7ST!ME,6FI1-1+E ta"le contains these columns:
+7ST!ME,6I& 17M;E,3G5
1E*6;--1+E 17M;E,3D825
P,E.6;--1+E 17M;E,3D825
P-YME1TS 17M;E,3D825
FI1-1+E6+0-,:E 17M;E,3D825
+,E&IT6IMIT 17M;E,3D5
You created a To#-n @uer$ re#ort that dis#la$s the account num"ers and new "alance o%
the F(( accounts that have the hi)hest new "alance value. The results are sorted "$
#a$ments value %rom hi)hest to lowest. *hich SEE+T statement clause is included in
$our @uer$/



Inner @uer$: !,&E, ;Y new6"alance &ES+ 345

Inner @uer$: *0E,E ,!*17M 9 F((

!uter @uer$: !,&E, ;Y new6"alance &ES+

Inner @uer$: SEE+T customer6id8 new6"alance ,!*17M


1D. *hich statement a"out an inline view is true/


-n inline view is a schema o"Aect.

-n inline view is a su"@uer$ in the F,!M clause8 o%ten named with an alias. 345

-n inline view is a com#lex view.

-n inline view can "e used to #er%orm &M o#erations.


1F. The EMP!YEES ta"le contains these columns:
EMP!YEE6I& 17M;E,
-ST61-ME .-,+0-,232'5
FI,ST61-ME .-,+0-,232'5
&EP-,TME1T6I& 17M;E,
E!;6I& .-,+0-,32'5
M-1-:E,6I& 17M;E,
S--,Y 17M;E,3G825
+!MMISS!I1 17M;E,3D825
0I,E6&-TE &-TE
*hich SEE+T statement could "e used to dis#la$ the 1( lowest #aid cler?s that "elon)
to de#artment D(/



SEE+T ,!*17M H,an?in)H8 last6nameIIJ 8JII%irst6name HEm#lo$eeH8 salar$
HSalar$H
F,!M
3SEE+T last6name8 %irst6name8 salar$
F,!M em#lo$ees
!,&E, ;Y salar$5
*0E,E ,!*17M K91( -1& Ao"6id I2E J+E,2J -1& de#artment6id 9 D(<


SEE+T ,!*17M H,an?in)H8last6nameIIJ8JII%irst6name HEm#lo$eeH8 salar$ HSalar$H
F,!M
3SEE+T last6name8 %irst6name8 salar$8 Ao"6id
F,!M em#lo$ees
*0E,E Ao"6id I2E J+E,2J -1& de#artment6id 9 D(
!,&E, ;Y salar$5
*0E,E ,!*17M K91(<
345


SEE+T ,!*17M H,an?in)H8 last6nameIIJ 8JII%irst6name HEm#lo$eeH8 salar$
HSalar$H
F,!M
3SEE+T last6name8 %irst6name8 salar$8 Ao"6id8 de#t6id
F,!M em#lo$ees
*0E,E ,!*17M K91(
!,&E, ;Y salar$5
*0E,E Ao"6id I2E J+E,2J -1& de#artment6id 9 D(<


The onl$ wa$ is to use the data dictionar$.
1G. Evaluate this +,E-TE .IE* statement:
+,E-TE .IE* sales6view
-S SEE+T customer6id8 re)ion8 S7M3sales6amount5
F,!M sales
*0E,E re)ion I1 31(8 2(8 =(8 >(5
:,!7P ;Y re)ion8 customer6id<
*hich statement is true/

You can modi%$ data in the S-ES ta"le usin) the S-ES6.IE* view.

You cannot modi%$ data in the S-ES ta"le usin) the S-ES6.IE* view. 345

You can onl$ insert records into the S-ES ta"le usin) the S-ES6.IE* view.

The +,E-TE .IE* statement )enerates an error.


2(. You want to create a view "ased on the S-ES,EP ta"le. You #lan to )rant access
to this view to mem"ers o% the Sales de#artment. You want Sales em#lo$ees to "e a"le to
u#date the S-ES,EP ta"le throu)h the view8 which $ou #lan to name
S-ES,EP6.IE*. *hat should not "e s#eci%ied in $our +,E-TE .IE* statement/


The -S ?e$word

- *0E,E clause

The I1 ?e$word

- :,!7P ;Y clause 345


21. -s user Eulie8 $ou issue this statement:
+,E-TE SY1!1YM em# F!, sam.em#lo$ees<
*hich tas? was accom#lished "$ this statement/


You created a #u"lic s$non$m on the EMP ta"le owned "$ user Sam.

You created a #rivate s$non$m on the EMP!YEES ta"le that $ou own.

You created a #u"lic s$non$m on the EMP!YEES ta"le owned "$ user Sam.

You created a #rivate s$non$m on the EMP!YEES ta"le owned "$ user Sam. 345
22. 7ni@ue indexes are automaticall$ created on columns that have which two t$#es o%
constraints/


1!T 17 and 71IL7E

71IL7E and P,IM-,Y 2EY 345

71IL7E and F!,EI:1 2EY

P,IM-,Y 2EY and F!,EI:1 2EY

2=. *hich o% the %ollowin) SL statements will dis#la$ the index name8 ta"le name8 and
the uni@ueness o% the index %or all indexes on the EMP!YEES ta"le/


+,E-TE index6name8 ta"le6name8 uni@ueness
F,!M user6indexes
*0E,E ta"le6name 9 JEMP!YEESJ<


SEE+T index6name8 ta"le6name8 uni@ueness
F,!M JEMP!YEESJ<


SEE+T index6name8 ta"le6name8 uni@ueness
F,!M user6indexes
*0E,E ta"le6name 9 JEMP!YEESJ<
345


SEE+T index6name8 ta"le6name8 uni@ueness
F,!M user6indexes
*0E,E index 9 EMP!YEES<







2>. *hich statement would $ou use to remove the -ST61-ME6I&M index on the
-ST61-ME column o% the EMP!YEES ta"le/


&,!P I1&EM last6name6idx<345
&,!P I1&EM last6name6idx3last6name5<

&,!P I1&EM last6name6idx3em#lo$ees.last6name5<

-TE, T-;E em#lo$ees
&,!P I1&EM last6name6idx<


2'. The %ollowin) indexes exist on the EMP!YEES ta"le:
- uni@ue index on the EMP!YEE6I& #rimar$ ?e$ column
- non-uni@ue index on the E!;6I& column
- com#osite index on the FI,ST61-ME and -ST61-ME columns.
I% the EMP!YEES ta"le is dro##ed8 which indexes are automaticall$ dro##ed at the
same time/

EMP6I& onl$

E!;6I& onl$

&EPT6I& onl$

EMP6I& and E!;6I&

-ll Indexes 345


2B. The +7ST!ME,S ta"le exists in user Mar$Js schema. *hich statement should $ou
use to create a s$non$m %or all data"ase users on the +7ST!ME,S ta"le/
+,E-TE P7;I+ SY1!1YM cust !1 mar$.customers<

+,E-TE P7;I+ SY1!1YM cust F!, mar$.customers< 345

+,E-TE SY1!1YM cust !1 mar$.customers F!, P7;I+<


+,E-TE SY1!1YM cust !1 mar$.customers<
:,-1T SEE+T !1 cust T! P7;I+<

2D. *hat is the s$ntax %or creatin) an index/

+,E-TE I1&EM index6name !1 ta"le6name3column6name5< 345

+,E-TE I1&EM !1 ta"le6name3column6name5<

+,E-TE index6name I1&EM !1 ta"le6name.column6name<

+,E-TE !, ,EP-+E I1&EM index6name !1 ta"le6name3column6name5<

2F. The EMP!YEES ta"le contains these columns:
EMP6I& 1!T 178 Primar$ 2e$
SS17M 1!T 178 7ni@ue
-ST61-ME .-,+0-,232'5
FI,ST61-ME .-,+0-,232'5
&EPT6I& 17M;E, Forei)n 2e$ to &EPT6I& column o% the &EP-,TME1TS ta"le
S--,Y 17M;E,3F825
You execute this statement:
+,E-TE I1&EM em#6name6idx
!1 em#lo$ees3last6name8 %irst6name5<
*hich statement is true/

The statement creates a %unction-"ased index.

The statement %ails "ecause o% a s$ntax error.

The statement creates a com#osite uni@ue index.

The statement creates a com#osite non-uni@ue index. 345


2G. *hat would $ou create to ma?e the %ollowin) statement execute %aster/
SEE+T 4
F,!M em#lo$ees
*0E,E !*E,3last6name5 9 Jchan)J<

- s$non$m.

-n index8 either a normal or a %unction6"ased index. 345

- com#osite index.

1othin)< the #er%ormance o% this statement cannot "e im#roved.
=(. *hich o% the %ollowin) is created automaticall$ "$ !racle when a 71IL7E inte)rit$
constraint is created/

- P,IM-,Y 2EY constraint

- +0E+2 constraint

-n index 345

- F!,EI:1 2EY constraint

=1. *hat is the most common use %or a Se@uence/


To )enerate #rimar$ ?e$ values 345

To im#rove the #er%ormance o% some @ueries

To )ive an alternative name %or an o"Aect

To lo)icall$ re#resent su"sets o% data %rom one or more ta"les

=2. *hich statement would $ou use to remove the EMP6I&6SEL se@uence/

&EETE SEL7E1+E em#6id6se@<

&,!P SEL7E1+E em#6id6se@< 345

-TE, SEL7E1+E em#6id6se@ ...<

,EM!.E SEL7E1+E em#6id6se@<

==. Evaluate this statement:
SEE+T #o6itemid6se@.+7,,.-
F,!M dual<
*hat does this statement accom#lish/

It resets the current value o% the P!6ITEM6I&6SEL se@uence.

It dis#la$s the current value o% the P!6ITEM6I&6SEL se@uence. 345

It dis#la$s the next availa"le value o% the P!6ITEM6I&6SEL se@uence.

It sets the current value o% the P!6ITEM6I&6SEL se@uence to the value o% the
P!6ITEMI& column.
=>. +reatin) a se@uence with 1!+-+0E ensures that all num"ers in the se@uenceJs
ran)e will "e used success%ull$. True or False/


True

False 345


='. You issue this statement:
-TE, SEL7E1+E #o6se@uence I1+,EME1T ;Y 2<
*hich statement is true/
Se@uence num"ers will "e cached.

Future se@uence num"ers )enerated will increase "$ 2 each time a num"er is
)enerated. 345

I% the P!6SEL7E1+E se@uence does not exist8 it will "e created.

The statement %ails i% the current value o% the se@uence is )reater than the ST-,T
*IT0 value.


=B. *hich ?e$word would $ou use to )rant an o"Aect #rivile)e to all data"ase users/

-&MI1

-

P7;I+ 345

7SE,S

=D. *hen )rantin) an o"Aect #rivile)e8 which o#tion would $ou include to allow the
)rantee to )rant the #rivile)e to another user/


*IT0 :,-1T !PTI!1 345

*IT0 -&MI1 !PTI!1

P7;I+

F!,+E
=F. *hich statement would $ou use to remove an o"Aect #rivile)e )ranted to a user/

-TE, 7SE,

,E.!2E 345

,EM!.E

&,!P

=G. *hich o% the %ollowin) sim#li%ies the administration o% #rivile)es/


-n index

- view

- tri))er

- role 345

>(. 7ser ;!;Js schema contains an EMP!YEES ta"le. ;!; executes the %ollowin)
statement:
:,-1T SEE+T !1 em#lo$ees T! mar$ *IT0 :,-1T !PTI!1<
*hich o% the %ollowin) statements can M-,Y now execute success%ull$/ 3+hoose two5



3+hoose all answers5

SEE+T F,!M "o".em#lo$ees< 345

,E.!2E SEE+T !1 "o".em#lo$ees F,!M "o"<

:,-1T SEE+T !1 "o".em#lo$ees T! P7;I+< 345

&,!P T-;E "o".em#lo$ees<




>1. *hich o% the %ollowin) "est descri"es the #ur#ose o% the ,EFE,E1+ES o"Aect
#rivile)e on a ta"le/


It allows a userJs session to read %rom the ta"le "ut onl$ so that %orei)n ?e$ constraints
can "e chec?ed. 345

It allows a user to re%er to the ta"le in a SEE+T statement.

It allows a user to create %orei)n ?e$ constraints on the ta"le.

It allows the user to create new ta"les which contain the same data as the re%erenced
ta"le.



>2. 7ser S7S-1 creates an EMP!YEES ta"le8 and then creates a view EMP6.IE*
which shows onl$ the FI,ST61-ME and -ST61-ME columns o% EMP!YEES.
7ser ,7&I needs to "e a"le to access em#lo$eesJ names "ut no other data %rom
EMP!YEES. *hich statement should S7S-1 execute to allow this/

SEE+T 4 F,!M em#6view F!, rudi<

+,E-TE SY1!1YM em#6view F!, em#lo$ees<

:,-1T SEE+T !1 em#6view T! rudi< 345

:,-1T SEE+T !1 em#6view !1Y T! rudi<


>=. 7ser -&-M has success%ull$ lo))ed on to the data"ase in the #ast8 "ut toda$ he
receives an error messa)e statin) that 3althou)h he has entered his #assword l$5 he cannot
lo) on. *hat is the most li?el$ cause o% the #ro"lem/
!ne or more o"Aect #rivile)es have "een ,E.!2Ed %rom -dam.

-&-MJs +,E-TE SESSI!1 #rivile)e has "een revo?ed. 345

-&-MJs +,E-TE 7SE, #rivile)e has "een revo?ed.

-&-MJs user account has "een removed %rom the data"ase.


>>. 7ser +0-1: has "een )ranted SEE+T8 7P&-TE8 I1SE,T and &EETE
#rivile)es on the EMP!YEES ta"le. You now want to #revent +han) %rom addin) or
deletin) rows %rom the ta"le8 while still allowin) him to read and modi%$ existin) rows.
*hich statement should $ou use to do this/

,E.!2E - !1 em#lo$ees F,!M chan)<

,E.!2E I1SE,T8 &EETE !1 em#lo$ees F,!M chan)< 345

,EM!.E I1SE,T8 &EETE !1 em#lo$ees F,!M chan)<

,E.!2E I1SE,T -1& &EETE !1 em#lo$ees F,!M chan)<

>'. The data"ase administrator wants to allow user Marco to create new ta"les in his
own schema. *hich #rivile)e should "e )ranted to Marco/


+,E-TE -1Y T-;E

SEE+T

+,E-TE T-;E 345

+,E-TE !;EE+T

>B. You )rant user -MY the +,E-TE SESSI!1 #rivile)e. *hich t$#e o% #rivile)e
have $ou )ranted to -MY/


- s$stem #rivile)e 345

-n o"Aect #rivile)e

- user #rivile)e

-n access #rivile)e






>D. 7ser 2ate wants to create indexes on ta"les in her schema. *hat #rivile)e must "e
)ranted to 2ate so that she can do this/


+,E-TE I1&EM

+,E-TE -1Y I1&EM

-TE, T-;E

1one< users do not need extra #rivile)es to create indexes on ta"les in their own
schema 345


>F. 7ser E-MES has created a +7ST!ME,S ta"le and wants to allow all other users
to SEE+T %rom it. *hich command should E-MES use to do this/


:,-1T customers3SEE+T5 T! P7;I+<

:,-1T SEE+T !1 customers T! -<

:,-1T SEE+T !1 customers T! P7;I+< 345

+,E-TE P7;I+ SY1!1YM customers F!, Aames.customers<

>G. Steven 2in)Js row in the EMP!YEES ta"le has EMP!YEE6I& 9 1(( and
S--,Y 9 2>(((. - user issues the %ollowin) statements in the order shown:
7P&-TE em#lo$ees
SET salar$ 9 salar$ 4 2
*0E,E em#lo$ee6id 9 1((<
+!MMIT<
7P&-TE em#lo$ees
SET salar$ 9 =((((
*0E,E em#lo$ee6id 9 1((<
The userJs data"ase session now ends a"normall$. *hat is now 2in)Js salar$ in the ta"le/

>F((( 345

=((((

2>(((

DF(((
'(. I% a data"ase crashes8 all uncommitted chan)es are automaticall$ rolled "ac?. True or
False/


True 345

False

Potrebbero piacerti anche