Download as pdf or txt
Download as pdf or txt
You are on page 1of 81

Page 1 of 81 Introduction to Oracle9i Questions and Answers Lesson 1: Basic SELECT Statement

1. The CUSTOMERS table has these columns: CUSTOMER_ID CUSTOMER_N#ME CUSTOMER_#DDRESS CUSTOMER_)%ONE NUMBER !" NOT NULL $#RC%#R& 1''" NOT NULL $#RC%#R& 1('" $#RC%#R& &'"

*ou nee+ to ,-o+uce out,ut that states .Dea- Custome- custome-_name/ .. The custome-_name +ata 0alues come 1-om the CUSTOMER_N#ME column in the CUSTOMERS table. 2hich statement ,-o+uces this out,ut3 #. SELECT +ea- custome-/ custome-_name/ 4ROM custome-s5 B. SELECT .Dea- Custome-./ custome-_name 66 7/7 4ROM custome-s5 C. SELECT 7Dea- Custome- 7 66 custome-_name 7/7 4ROM custome-s5 D. SELECT 7Dea- Custome- 7 66 custome-_name 66 7/7 4ROM custome-s5 E. SELECT .Dea- Custome- . 66 custome-_name 66 ./. 4ROM custome-s5 4. SELECT 7Dea- Custome- 7 66 custome-_name 66 7/7 66 4ROM custome-s5 #ns8e-: D &. # SELECT statement can be use+ to ,e-1o-m these th-ee 1unctions: 1. Choose -o8s 1-om a table. &. Choose columns 1-om a table 9. B-in: to:ethe- +ata that is sto-e+ in +i11e-ent tables b; c-eatin: a lin< bet8een them. 2hich set o1 <e;8o-+s +esc-ibes these ca,abilities3 #. +i11e-ence/ ,-o=ection/ =oin B. selection/ ,-o=ection/ =oin C. selection/ inte-section/ =oin D. inte-section/ ,-o=ection/ =oin E. +i11e-ence/ ,-o=ection/ ,-o+uct #ns8e-: B 9. 2hich statement co--ectl; +esc-ibes S>L an+ iS>L?)lus Comman+s3 #. Both S>L an+ iS>L?,lus allo8 mani,ulation o1 0alues in the +atabase. B. iS>L?)lus -eco:ni@es S>L statements an+ sen+s them to the se-0e-5 S>L is the O-acle ,-o,-ieta-; inte-1ace 1o- eAecutin: S>L statements. C. iS>L?)lus is a lan:ua:e 1o- communicatin: 8ith the O-acle se-0e- to access +ata5 S>L -eco:ni@es S>L statements an+ sen+s them to the se-0e-. D. S>L mani,ulates +ata an+ table +e1initions in the +atabase5 iS>L?)lus +oes not allo8 mani,ulation o1 0alues in the +atabase.

Page 2 of 81
#ns8e-: D

!. E0aluate this S>L statement:


SELECT e.em,lo;ee_i+/ .1(? e.sala-;" B .( ? e.commission_,ct" B s.sales amount ? .9( ? e.bonus"" #S C#LC_$#LUE 4ROM em,lo;ees e/ sales s 2%ERE e.em,lo;ee_i+ C s.em,_i+5

2hat 8ill ha,,en i1 ;ou -emo0e all the ,a-entheses 1-om the calculation3 #. The 0alue +is,la;e+ in the C#LC_$#LUE column 8ill be lo8e-. B. The 0alue +is,la;e+ in the C#LC_$#LUE column 8ill be hi:he-. C. The-e 8ill be no +i11e-ence in the 0alue +is,la;e+ in the C#LC_$#LUE column. D. #n e--o- 8ill be -e,o-te+. #ns8e-: C (. 4-om S>L?)lus/ ;ou issue this SELECT statement: SELECT? 4-om o-+e-s5 *ou use this statement to -et-ie0e +ata 1-om a +ata table 1o- __________. Choose all that a,,l;" #. U,+atin: B. $ie8in: C. Deletin: D. Inse-tin: E. T-uncatin: #ns8e-: B/ D D. 2hich t8o a-e att-ibutes o1 iS>L?)lus3 Choose t8o" #. iS>L?)lus comman+s cannot be abb-e0iate+. B. iS>L?)lus comman+s a-e accesses 1-om a b-o8se-. C. iS>L?)lus comman+s a-e use+ to mani,ulate +ata in tables. D. iS>L?)lus comman+s mani,ulate table +e1initions in the +atabase. E. iS>L?)lus is the O-acle ,-o,-ieta-; inte-1ace 1o- eAecutin: S>L statements. #ns8e-: B/ E E. 2hich S>L statement :ene-ates the alias #nnual Sala-; 1o- the calculate+ column S#L#R*?1&3 #. SELECT ename/ sala-;?1& F#nnual Sala-;G 4ROM em,lo;ees5 B. SELECT ename/ sala-;?1& H#nnual Sala-;I 4ROM em,lo;ees5

Page 3 of 81
C. SELECT ename/ sala-;?1& #S #nnual Sala-; 4ROM em,lo;ees5 D. SELECT ename/ sala-;?1& #S INITC#) H#NNU#L S#L#R*I" 4ROM em,lo;ees #ns8e-: B J. E0aluate this S>L statement:
SELECT e.EM)LO*EE_ID/e.L#ST_N#ME/e.DE)#RTMENT_ID/ +.DE)#RTMENT_N#ME 4ROM EM) e/ DE)#RTMENT + 2%ERE e.DE)#RTMENT_ID C +.DE)#RTMENT_ID5

In the statement/ 8hich ca,abilities o1 a SELECT statement a-e ,e-1o-me+3 #. Selection/ ,-o=ection/ =oin B. Di11e-ence/ ,-o=ection/ =oin C. Selection/ inte-section/ =oin D. Inte-section/ ,-o=ection/ =oin E. Di11e-ence/ ,-o=ection/ ,-o+uct #ns8e-: # K. 2hich is an iS>L?)lus comman+3 #. INSERT B. U)D#TE C. SELECT D. DESCRIBE E. DELETE 4. REN#ME #ns8e-: D 1'. *ou nee+ to ,-o+uce a -e,o-t 1o- mailin: labels 1o- all custome-s. The mailin: label must ha0e onl; the custome- name an+ a++-ess. The CUSTOMERS table has these columns: CUST_ID CUST_N#ME CUST_#DDRESS CUST_)%ONE NUMBER !" $#RC%#R& 1''" $#RC%#R& 1('" $#RC%#R& &'" NOT NULL NOT NULL

2hich SELECT statement accom,lishes this tas<3

Page 4 of 81
#. SELECT ? 4ROM custome-s5 B. SELECT name/ a++-ess 4ROM custome-s5 C. SELECT i+/ name/ a++-ess/ ,hone 4ROM custome-s5 D. SELECT cust_name/ cust_a++-ess 4ROM custome-s5 E. SELECT cust_i+/ cust_name/ cust_a++-ess/ cust_,hone 4ROM custome-s5 #ns8e-: D 11. E0aluate this S>L statement: SELECT ename/ sal/ 1&?salB1'' 4ROM em,5 The S#L column sto-es the monthl; sala-; o1 the em,lo;ee. 2hich chan:e must be ma+e to the abo0e s;ntaA to calculate the annual com,ensation as .monthl; sala-; ,lus a monthl; bonus o1 L1''/ multi,lie+ b; 1&.3 #. No chan:e is -eMui-e+ to achie0e the +esi-e+ -esults. B. SELECT ename/ sal/ 1&? salB1''" 4ROM em,5 C. SELECT ename/ sal/ 1&?sal"B1'' 4ROM em,5 D. SELECT ename/ salB1''/?1& 4ROM em,5 #ns8e-: B 19. The STUDENT_NR#DES table has these columns STUDENT_ID SEMESTER_END N)# NUMBER 1&" D#TE NUMBER !/9"

2hich statement 1in+s stu+ents 8ho ha0e a :-a+e ,oint a0e-a:e N)#" :-eate- than 9.' 1o- the calen+a- ;ea- &''13 #. SELECT stu+ent_i+/ :,a 4ROM stu+ent_:-a+es 2%ERE semeste-_en+ BET2EEN G'1OP#NO&''1G #ND G91ODECO&''1G OR :,a Q 9.5 B. SELECT stu+ent_i+/ :,a 4ROM stu+ent_:-a+es 2%ERE semeste-_en+ BET2EEN G'1OP#NO&''1G #ND G91ODECO&''1G #ND :,a :t 9.'5 C. SELECT stu+ent_i+/ :,a 4ROM stu+ent_:-a+es 2%ERE semeste-_en+ BET2EEN G'1OP#NO&''1G #ND G91ODECO&''1G #ND :,a Q 9.'5 D. SELECT stu+ent_i+/ :,a 4ROM stu+ent_:-a+es 2%ERE semeste-_en+ BET2EEN G'1OP#NO&''1G #ND G91ODECO&''1G #ND :,a Q 9.'5 E. SELECT stu+ent_i+/ :,a 4ROM stu+ent_:-a+es 2%ERE semeste-_en+ Q G'1OP#NO&''1G OR semeste-_en+ R G91ODECO&''1G #ND :,a QC 9.'5

Page 5 of 81
#ns8e-: C

Lesson &: Rest-ictin: an+ So-tin: Data 1. The EM) table contains these columns: L#ST N#ME $#RC%#R& &(" S#L#R* NUMBER D/&" DE)#RTMENT_ID NUMBER D" *ou nee+ to +is,la; the em,lo;ees 8ho ha0e not been assi:ne+ to an; +e,a-tment. *ou 8-ite the SELECT statement: SELECT L#ST_N#ME/ S#L#R*/ DE)#RTMENT_ID 4ROM EM) 2%ERE DE)#RTMENT_ID C NULL5 2hat is t-ue about this S>L statement3 #. The S>L statement +is,la;s the +esi-e+ -esults. B. The column in the 2%ERE clause shoul+ be chan:e+ to +is,la; the +esi-e+ -esults. C. The o,e-ato- in the 2%ERE clause shoul+ be chan:e+ to +is,la; the +esi-e+ -esults. D. The 2%ERE clause shoul+ be chan:e+ to use an oute- =oin to +is,la; the +esi-e+ -esults. #ns8e-: C &. The CUSTOMERS table has these columns: CUSTOMER_ID CUSTOMER_N#ME STREET_#DDRESS CIT*_#DDRESS ST#TE_#DDRESS )RO$INCE_#DDRESS COUNTR*_#DDRESS )OST#L_CODE CUSTOMER_)%ONE NUMBER !" NOT NULL $#RC%#R& 1''" NOT NULL $#RC%#R& 1('" $#RC%#R& ('" $#RC%#R& ('" $#RC%#R& ('" $#RC%#R& ('" $#RC%#R& 1&" $#RC%#R& &'"

2hich statement 1in+s the -o8s in the CUSTOMERS table that +o not ha0e a ,ostal co+e3

#. SELECT custome-_i+/ custome-_name 4ROM custome-s 2%ERE ,ostal_co+e CONT#INS NULL5 B. SELECT custome-_i+/ custome-_name 4ROM custome-s

Page 6 of 81
2%ERE ,ostal_co+e C 7________75 C. SELECT custome-_i+/ custome-_name 4ROM custome-s 2%ERE ,ostal_co+e IS NULL5 D. SELECT custome-_i+/ custome-_name 4ROM custome-s 2%ERE ,ostal co+e IS N$L5 E. SELECT custome-_i+/ custome-_name 4ROM custome-s 2%ERE ,ostal_co+e C NULL5 #ns8e-: C 9. The STUDENT_NR#DES table has these columns: STUDENT_ID SEMESTER_END N)# NUMBER 1&" D#TE NUMBER !/9"

The -e:ist-a- -eMueste+ a -e,o-t listin: the stu+ents7 :-a+e ,oint a0e-a:es N)#" so-te+ 1-om hi:hest :-a+e ,oint a0e-a:e to lo8est. 2hich statement ,-o+uces a -e,o-t that +is,la;s the stu+ent ID an+ N)# in the so-te+ o-+e- -eMueste+ b; the -e:ist-a-3 #. SELECT stu+ent_i+/ :,a 4ROM stu+ent_:-a+es ORDER B* :,a #SC5 B. SELECT stu+ent_i+/ :,a 4ROM stu+ent_:-a+es SORT ORDER B* :,a #SC5 C. SELECT stu+ent_i+/ :,a 4ROM stu+ent_:-a+es SORT ORDER B* :,a5 D. SELECT stu+ent_i+/ :,a 4ROM stu+ent_:-a+es ORDER B* :,a5 E. SELECT stu+ent_i+/ :,a 4ROM stu+ent_:-a+es SORT ORDER B* :,a DESC5 4. SELECT stu+ent_i+/ :,a 4ROM stu+ent_:-a+es ORDER B* :,a DESC5 #ns8e-: 4 !. The EM)LO*EES table contains these columns: EM)LO*EE_ID L#ST_N#ME POB_ID NUMBER !" $#RC%#R& &(" $#RC%#R& 1'"

*ou 8ant to sea-ch 1o- st-in:s that contain 7S#_7 in the POB_ID column. 2hich S>L statement +o ;ou use3 #. SELECT em,lo;ee_i+/ last_name/ =ob_i+ 4ROM em,lo;ees 2%ERE =ob_i+ LISE 7TS#U_T7 ESC#)E 7U75 B. SELECT em,lo;ee_i+/ last_name/ =ob_i+ 4ROM em,lo;ees 2%ERE =ob_i+ LISE 7TS#_75 C. SELECT em,lo;ee_i+/ last_name/ =ob_i+ 4ROM em,lo;ees 2%ERE =ob_i+ LISE 7TS#_7 ESC#)E .U.5 D. SELECT em,lo;ee_i+/ last_name/ =ob_i+ 4ROM em,lo;ees 2%ERE =ob_i+ C 7TS#_75

Page 7 of 81
#ns8e- : # (. The CUSTOMERS table has these columns: CUSTOMER_ID CUSTOMER_N#ME STREET_#DDRESS CIT*_#DDRESS ST#TE_#DDRESS )RO$INCE_#DDRESS COUNTR*_#DDRESS )OST#L_CODE CUSTOMER_)%ONE NUMBER !" NOT NULL $#RC%#R& 1''" NOT NULL $#RC%#R& 1('" $#RC%#R& ('" $#RC%#R& ('" $#RC%#R& ('" $#RC%#R& ('" $#RC%#R& 1&" $#RC%#R& &'"

# ,-omotional sale is bein: a+0e-tise+ to the custome-s in 4-ance. 2hich 2%ERE clause i+enti1ies custome-s that a-e locate+ in 4-ance3 #. 2%ERE lo8e- count-;_a++-ess" C .1-ance. B. 2%ERE lo8e- count-;_a++-ess" C 71-ance7 C. 2%ERE lo8e- count-;_a++-ess" IS 71-ance7 D. 2%ERE lo8e- count-;_a++-ess" C 7T1-anceT7 E. 2%ERE lo8e- count-;_a++-ess" LISE T1-anceT #ns8e-: B D. The )RODUCTS table has these columns: )RODUCT_ID )RODUCT_N#ME )RICE NUMBER !" $#RC%#R& !(" NUMBER J/&"

E0aluate this S>L statement: SELECT ? 4ROM )RODUCTS ORDER B* ,-ice/ ,-o+uct_name5 2hat is t-ue about the S>L statement3 #. The -esults a-e not so-te+. B. The -esults a-e so-te+ nume-icall;. C. The -esults a-e so-te+ al,habeticall;. D. The -esults a-e so-te+ nume-icall; an+ then al,habeticall;. #ns8e-: D E. E0aluate these t8o S>L statements: SELECT last_name/ sala-;/ hi-e_+ate4ROM EM)LO*EES ORDER B* sala-; DESC5 SELECT last_name/ sala-;/ hi-e_+ate4ROM EM)LO*EES ORDER B* & DESC5 2hat is t-ue about them3

Page 8 of 81
#. The t8o statements ,-o+uce i+entical -esults. B. The secon+ statement -etu-ns a s;ntaA e--o-. C. The-e is no nee+ to s,eci1; DESC because the -esults a-e so-te+ in +escen+in: o-+e- b; +e1ault. D. The t8o statements can be ma+e to ,-o+uce i+entical -esults b; a++in: a column alias 1othe sala-; column in the secon+ S>L statement. #ns8e-: # J. EAamine the st-uctu-e o1 the STUDENTS table: STUDENT_ID STUDENT_N#ME COURSE_ID M#RSS ST#RT_D#TE 4INIS%_D#TE NUMBER $#RC%#R& 9'" $#RC%#R& 1'" NUMBER D#TE D#TE NOT NULL/ )-ima-; Se; NOT NULL

*ou nee+ to c-eate a -e,o-t o1 the 1' stu+ents 8ho achie0e+ the hi:hest -an<in: in the cou-se INT S>L an+ 8ho com,lete+ the cou-se in the ;ea- 1KKK. 2hich S>L statement accom,lishes this tas<3 #. SELECT stu+ent_ i+/ ma-<s/ RO2NUM .Ran<. 4ROM stu+ents 2%ERE RO2NUM RC 1' #ND 1inish_+ate BET2EEN 7'1OP#NOKK7 #ND 791ODECOKK #ND cou-se_i+ C 7INT_S>L7 ORDER B* ma-<s DESC5 B. SELECT stu+ent_i+/ ma-<s/ RO2ID .Ran<. 4ROM stu+ents 2%ERE RO2ID RC 1' #ND 1inish_+ate BET2EEN 7'1OP#NOKK7 #ND 791ODECOKK7 #ND cou-se_i+ C 7INT_S>L7 ORDER B* ma-<s5 C. SELECT stu+ent_i+/ ma-<s/ RO2NUM .Ran<. 4ROM SELECT stu+ent_i+/ ma-<s 4ROM stu+ents 2%ERE RO2NUM RC 1' #ND 1inish_+ate BET2EEN 7'1OP#NOKK7 #ND 791ODECOKK7 #ND cou-se_i+ C 7INT_S>L7 ORDER B* ma-<s DESC"5

D. SELECT stu+ent_i+/ ma-<s/ RO2NUM .Ran<I 4ROM SELECT stu+ent_i+/ ma-<s 4ROM stu+ents 2%ERE 1inish_+ate BET2EEN G'1OP#NOKK #ND G91ODECOKKG #ND cou-se_i+ C FINT_S>LG ORDER B* ma-<s DESC"

Page 9 of 81
2%ERE RO2NUM RC 1' 5 E. SELECT stu+ent i+/ ma-<s/ RO2NUM HRan<I 4ROM SELECT stu+ent_i+/ ma-<s 4ROM stu+ents ORDER B* ma-<s" 2%ERE RO2NUM RC 1' #ND 1inish +ate BET2EEN G'1OP#NOKKG #ND G91ODECOKKG #ND cou-se_i+ C FINT_S>LG5 #ns8e-: D K. E0aluate the S>L statement: SELECT ROUND TRUNC MOD 1D''/1'"/O1"/&" 4ROM +ual5 2hat 8ill be +is,la;e+3 #. ' B. 1 C. '.'' D. #n e--o- statement #ns8e-: # 1'. *ou 8ant to +is,la; the titles o1 boo<s that meet these c-ite-ia: 1. )u-chase+ be1o-e Panua-; &1/ &''1 &. )-ice is less then L('' o- :-eate- than LK'' *ou 8ant to so-t the -esults b; thei- +ata o1 ,u-chase/ sta-tin: 8ith the most -ecentl; bou:ht boo<. 2hich statement shoul+ ;ou use3 #. SELECT boo<_title 4ROM boo<s 2%ERE ,-ice bet8een ('' an+ K'' #ND ,u-chase_+ate R G&1OP#NO&''1G ORDER B* ,u-chase_+ate5 B. SELECT boo<_title 4ROM boo<s 2%ERE ,-ice IN (''/K''" #ND ,u-chase_+ate R G&1OP#NO&''1G ORDER B* ,u-chase +ate #SC5 C. SELECT boo<_title 4ROM boo<s 2%ERE ,-ice R ('' o- Q K'' #ND ,u-chase_+ate R G&1OP#NO&''1G ORDER B* ,u-chase +ate DESC5 D. SELECT boo<_title 4ROM boo<s 2%ERE ,-ice R ('' OR ,-ice Q K''" #ND ,u-chase_+ate R G&1OP#NO&''1G ORDER B* ,u-chase +ate DESC5 #ns8e-: D 11. In a SELECT statement that inclu+es a 2%ERE clause/ 8he-e is the NROU) B* clause ,lace+ in the SELECT statement3 #. Imme+iatel; a1te- the SELECT clause B. Be1o-e the 2%ERE clause

Page 10 of 81
C. Be1o-e the 4ROM clause D. #1te- the ORDER B* clause E. #1te- the 2%ERE clause #ns8e-: E 1&. The STUDENT_NR#DES table has these columns: STUDENT_ID SEMESTER_END N)# NUMBER 1&" D#TE NUMBER !/9"

The -e:iste- has -eMueste+ a -e,o-t listin: the stu+ents7 :-a+e ,oint a0e-a:es N)#"/ so-te+ 1-om hi:hest :-a+e ,oint a0e-a:e to lo8est 8ithin each semeste-/ sta-tin: 1-om the ea-liest +ate. 2hich statement accom,lishes this3 #. SELECT stu+ent_i+/ semeste-_en+/ :,a 4ROM stu+ent_:-a+es ORDER B* semeste-_en+ DESC/ :,a DESC5 B. SELECT stu+ent_i+/ semeste-_en+/ :,a 4ROM stu+ent_:-a+es ORDER B* semeste-_en+ #SC/ :,a #SC5 C. SELECT stu+ent_i+/ semeste-_en+/ :,a 4ROM stu+ent_:-a+es ORDER B* semeste-_en+/ :,a DESC5 D. SELECT stu+ent_i+/ semeste-_en+/ :,a 4ROM stu+ent_:-a+es ORDER B* :,a DESC/ semeste-_en+ DESC5 E. SELECT stu+ent_i+/ semeste-_en+/ :,a 4ROM stu+ent_:-a+es ORDER B* :,a DESC/ semeste-_en+ #SC5 #ns8e-: C 19. The ORDERS table has these columns: ORDER_ID CUSTOMER_ID ORDER_TOT#L NUMBER !" NUMBER 1&" NUMBER 1'/&" NOT NULL NOT NULL

The ORDERS table t-ac<s the O-+e- numbe-/ the o-+e- total/ an+ the custome- to 8hom the O-+e- belon:s. 2hich t8o statements -et-ie0e o-+e-s 8ith an inclusi0e total that -an:es bet8een 1''.'' an+ &'''.'' +olla-s3 Choose t8o." #. SELECT custome-_i+/ o-+e-_i+/ o-+e-_total 4ROM o-+e-s

Page 11 of 81
R#NNE ON o-+e-_total 1'' #ND &'''" INCLUSI$E5 B. SELECT custome-_i+/ o-+e-_i+/ o-+e-_total 4ROM o-+e-s %#$INN o-+e-_total BET2EEN 1'' an+ &'''5 C. SELECT custome-_i+/ o-+e-_i+/ o-+e-_total 4ROM o-+e-s 2%ERE o-+e-_total BET2EEN 1'' an+ &'''5 D. SELECT custome-_i+/ o-+e-_i+/ o-+e-_total 4ROM o-+e-s 2%ERE o-+e-_total QC 1'' an+ RC &'''5 E. SELECT custome-_i+/ o-+e-_i+/ o-+e-_total 4ROM o-+e-s 2%ERE o-+e-_total QC 1'' an+ o-+e-_total RC &'''5 #ns8e-: C/ E 1!. The EM) table has these columns: EN#ME $#RC%#R& 9(" S#L#R* NUMBER J/&" %IRE_D#TE D#TE Mana:ement 8ants a list o1 names o1 em,lo;ees 8ho ha0e been 8ith the com,an; 1omo-e than 1i0e ;ea-s. 2hich S>L statement +is,la;s the -eMui-e+ -esults3 #. SELECT EN#ME 4ROM EM) 2%ERE S*SD#TEO%IRE_D#TE Q (5 B. SELECT EN#ME 4ROM EM) 2%ERE %IRE_D#TEOS*SD#TE Q (5 C. SELECT EN#ME 4ROM EM) 2%ERE S*SD#TEO%IRE_D#TE"V9D( Q (5 D. SELECT EN#ME 4ROM EM) 2%ERE S*SD#TEO%IRE_D#TE"? 9D( Q (5 #ns8e-: C 1(. E0aluate these t8o S>L statements: SELECT last_name/ sala-; / hi-e_+ate 4ROM EM)LO*EES ORDER B* sala-; DESC5

Page 12 of 81
SELECT last_name/ sala-;/ hi-e_+ate 4ROM EM)LO*EES ORDER B* & DESC5 2hat is t-ue about them3 #. The t8o statements ,-o+uce i+entical -esults. B. The secon+ statement -etu-ns a s;ntaA e--o-. C. The-e is no nee+ to s,eci1; DESC because the -esults a-e so-te+ in +escen+in: o-+eb; +e1ault. D. The t8o statements can be ma+e to ,-o+uce i+entical -esults b; a++in: a column alias 1o- the sala-; column in the secon+ S>L statement. #ns8e-: #

1D. 2hich t8o statements a-e t-ue -e:a-+in: the ORDER B* clause3 Choose t8o" #. The so-t is in ascen+in: b; o-+e- b; +e1ault. B. The so-t is in +escen+in: o-+e- b; +e1ault. C. The ORDER B* clause must ,-ece+e the 2%ERE clause. D. The ORDER B* clause is eAecute+ on the client si+e. E. The ORDER B* clause comes last in the SELECT statement. 4. The ORDER B* clause is eAecute+ 1i-st in the Mue-; eAecution. #ns8e-: #/ E

1E. *ou nee+ to +is,la; the last names o1 those em,lo;ees 8ho ha0e the lette- H#I as the secon+ cha-acte- in thei- names. 2hich S>L statement +is,la;s the -eMui-e+ -esults3 #. SELECT last_name 4ROM EM) 2%ERE last_name LISE F_#TG5 B. SELECT last_name 4ROM EM) 2%ERE last name CG?#TG C. SELECT last_name 4ROM EM) 2%ERE last name CG_#TG5 D. SELECT last_name 4ROM EM) 2%ERE last name LISE F?#TG #ns8e-: # Lesson 9: Sin:leORo8 4unctions 1. Mana:ement has as<e+ ;ou to calculate the 0alue 1&?sala-;? commission_,ct 1o- all the em,lo;ees in the EM) table. The EM) table contains these columns:

Page 13 of 81
L#ST N#ME $#RCN#R& 9(" S#L#R* NUMBER K/&" COMMISION_)CT NUMBER !/&" NOT NULL NOT NULL

2hich statement ensu-es that a 0alue is +is,la;e+ in the calculate+ columns 1o- all em,lo;ees3 #. SELECT last_name/ 1&?sala-;? commission_,ct 4ROM em,5 B. SELECT last_name/ 1&?sala-;? commission_,ct/'" 4ROM em,5 C. SELECT last_name/ 1&?sala-;? n0l commission_,ct/'"" 4ROM em,5 D. SELECT last_name/ 1&?sala-;? +eco+e commission_,ct/'"" 4ROM em,5 #ns8e-: C &. The EM)LO*EE tables has these columns: L#ST_N#ME $#RC%#R& 9(" S#L#R* NUMBER J/&" COMMISSION_)CT NUMBER (/&" *ou 8ant to +is,la; the name an+ annual sala-; multi,lie+ b; the commission_,ct 1oall em,lo;ees. 4o- -eco-+s that ha0e a NULL commission_,ct/ a @e-o must be +is,la;e+ a:ainst the calculate+ column. 2hich S>L statement +is,la;s the +esi-e+ -esults3 #. SELECT last_name/ B. SELECT last_name/ C. SELECT last_name/ D. SELECT last_name/ #ns8e-: D 9. The EM)LO*EES table contains these columns: L#ST_N#ME $#RC%#R& &(" S#L#R* NUMBER D/&" COMMISSION_)CT NUMBER D" *ou nee+ to 8-ite a Mue-; that 8ill ,-o+uce these -esults: 1. Dis,la; the sala-; multi,lie+ b; the commission_,ct. &. EAclu+e em,lo;ees 8ith a @e-o commission_,ct. 9. Dis,la; a @e-o 1o- em,lo;ees 8ith a null commission 0alue. E0aluate the S>L statement: SELECT L#ST_N#ME/ S#L#R*?COMMISSION_)CT 4ROM EM)LO*EES 2%ERE COMMISSION_)CT IS NOT NULL5 2hat +oes the statement ,-o0i+e3 sala-; ? 1&" ? commission_,ct 4ROM EM)LO*EES5 sala-; ? 1&" ? I4NULL commission_,ct/ '" 4ROM EM)LO*EES5 sala-; ? 1&" ? N$L& commission_,ct/ '" 4ROM EM)LO*EES5 sala-; ? 1&" ? N$L commission_,ct/ '" 4ROM EM)LO*EES5

Page 14 of 81
#. #ll o1 the +esi-e+ -esults B. T8o o1 the +esi-e+ -esults C. One o1 the +esi-e+ -esults D. #n e--o- statement #ns8e-: C

Page 15 of 81
!. E0aluate the S>L statement: SELECT ROUND !(.K(9/ O1"/ TRUNC !(.K9D/ &" 4ROM +ual5 2hich 0alues a-e +is,la;e+3 #. !D an+ !( B. !D an+ !(.K9 C. (' an+ !(.K9 D. (' an+ !(.K E. !( an+ !(.K9 4. !(.K( an+ !(.K9 #ns8e-: C (. The EM)LO*EES table contains these columns: EM)LO*EE_ID EN#ME POB_ID NUMBER !" $#RC%#R& &(" $#RC%#R& 1'"

2hich S>L statement 8ill -etu-n the EN#ME/ len:th o1 the EN#ME/ an+ the nume-ic ,osition o1 the lette- .a. in the EN#ME column/ 1o- those em,lo;ees 8hose EN#ME en+s 8ith a the lette- .n.3 #. SELECT EN#ME/ LENNT% EN#ME"/ INSTR EN#ME/ 7a7" 4ROM EM)LO*EES 2%ERE SUBSTR EN#ME/ O1/ 1" C 7n75 B. SELECT EN#ME/ LENNT% EN#ME"/ INSTR EN#ME/ /O1/1" 4ROM EM)LO*EES 2%ERE SUBSTR EN#ME/ O1/ 1" C 7n75 C. SELECT EN#ME/ LENNT% EN#ME"/ SUBSTR EN#ME/ O1/1" 4ROM EM)LO*EES 2%ERE INSTR EN#ME/ 1/ 1" C 7n75 D. SELECT EN#ME/ LENNT% EN#ME"/ SUBSTR EN#ME/ O1/1" 4ROM EM)LO*EES 2%ERE INSTR EN#ME/ O1/ 1" C 7n75 #ns8e-: #

Page 16 of 81
D. 2hich 1ou- a-e att-ibutes o1 sin:le -o8 1unctions3 Choose 1ou-." #. cannot be neste+ B. mani,ulate +ata items C. act on each -o8 -etu-ne+ D. -etu-n one -esult ,e- -o8 E. acce,t onl; one a-:ument an+ -etu-n onl; one 0alue 4. acce,t a-:uments 8hich can be a column o- an eA,-ession #ns8e-: B/ C/ D/ 4 E. 2hich S>L statement -etu-ns a nume-ic 0alue3 #. SELECT #DD_MONT%S M#W hi-e_Date"/ D" 4ROM EM)5 B. SELECT ROUND hi-e_+ate" 4ROM EM)5 C. SELECT s;s+ateOhi-e_+ate 4ROM EM)5 D. SELECT TO_NUMBER hi-e_+ate B E" 4ROM EM)5 #ns8e-: C J. 2hich t8o tas<s can ;ou ,e-1o-m usin: onl; the TO_C%#R 1unction3 Choose t8o." #. con0e-t 1' to 7TEN7 B. con0e-t 71'7 to 1' C. con0e-t 1' to 71'7 D. con0e-t 7TEN7 to 1' E. con0e-t a +ate to a cha-acte- eA,-ession 4. con0e-t a cha-acte- eA,-ession to a +ate #ns8e-: C/ E K. 2hich 1ou- a-e t;,es o1 1unctions a0ailable in S>L3 Choose !" #. st-in: B. cha-acteC. inte:eD. calen+aE. nume-ic 4. t-anslation N. +ate %. con0e-sion #ns8e-: B/ E/ N/ % 1'. 2hich S>L statement +is,la;s the +ate Ma-ch 1K/ &''1 in a 1o-mat that a,,ea-s as HNineteenth o1 Ma-ch &''1 1&:'':'' #MI3 #. SELECT TO_C%#R TO_D#TE 71KOMa-O&''1G/ FDDOMonO****G"/ F1mD+s,th Ho1I Month **** 1m%%:MI:SS #MG" NE2_D#TE 4ROM +ual5

Page 17 of 81
B. SELECT TO_C%#R TO_D#TE G1KOMa-O&''1G/ FDDOMonO****G"/ FD+s,th Ho1I Month **** 1m%%:MI:SS #MG" NE2_D#TE 4ROM +ual5 C. SELECT TO_C%#R TO_D#TE G1KOMa-O&''1G/ FDDOMonO****G"/ F1mD+s,th Ho1I Month **** %%:MI:SS #MG" NE2_D#TE 4ROM +ual5 D. SELECT TO_C%#R TO_D#TE G1KOMa-O&''1G/ FDDOMonO****"/ F1mD+s,th Ho1I Month ****1mt%%:%I:SS #M7" NE2_D#TE 4ROM +ual5 #ns8e-: # 11. *ou 8oul+ li<e to +is,la; the s;stem +ate in the 1o-mat .Mon+a;/ '1 Pune/ &''1.. 2hich SELECT statement shoul+ ;ou use3 #. SELECT TO_D#TE S*SD#TE/ 74MD#*/ DD Month/ ****7" 4ROM +ual5 B. SELECT TO_C%#R S*SD#TE/ 74MDD/ D* Month/ 7****7" 4ROM +ual5 C. SELECT TO_C%#R S*SD#TE/ 74MDa;/ DD Month/ ****7" 4ROM +ual5 D. SELECT TO_C%#R S*SD#TE/ 74MD*/ DDD Month/ ****7" 4ROM +ual5 E. SELECT TO_D#TE S*SD#TE/ 74MD*/ DDD Month/ ****7" 4ROM +ual5 #ns8e-: C 1&. 2hich SELECT statement 8ill the -esult Fello 8o-l+G 1-om the st-in: F%ello 2o-l+G3 #. SELECT SUBSTR F%ello 2o-l+G/1" 4ROM +ual5 B. SELECT INITC#) TRIM F%ello 2o-l+G/ 1/1"" 4ROM +ual5 C. SELECT LO2ER SUBSTR F%ello 2o-l+G/ 1/ 1" 4ROM +ual5 D. SELECT LO2ER SUBSTR F%ello 2o-l+G/ &/ 1" 4ROM +ual5 E. SELECT LO2ER TRIM F%G 4ROM F%ello 2o-l+G"" 4ROM +ual5 #ns8e-: E 19. 2hich 1ou- statements co--ectl; +esc-ibe 1unctions that a-e a0ailable in S>L3 Choose 1ou-" #. INSTR -etu-ns the nume-ic ,osition o1 a name+ cha-acte-. B. N$L& -etu-ns the 1i-st nonOnull eA,-ession in the eA,-ession list. C. TRUNC#TE -oun+s the column/ eA,-ession/ o- 0alue to n +ecimal ,laces. D. DECODE t-anslates an eA,-ession a1te- com,a-in: it to each sea-ch 0alue. E. TRIM t-ims the hea+in: o1 t-ailin: cha-acte-s o- both" 1-om a cha-acte- st-in:. 4. N$L com,a-es t8o eA,-essions an+ -etu-ns null i1 the; a-e eMual/ o- the 1i-st eA,-ession o1 the; a-e not eMual. N. NULLI4 com,a-es t8, eA,-essions an+ -etu-ns null i1 the; a-e eMual/ o- the 1i-st eA,-ession i1 the; a-e not eMual. #ns8e-: #/ D/ E/ N 1!. 2hich t8o tas<s can ;ou ,e-1o-m b; usin: the TO_C%#R 1unction3 Choose t8o"

Page 18 of 81
#. Con0e-t 1' to FTENG B. Con0e-t F1'G to 1' C. Con0e-t 1' to F1'G D. Con0e-t FTENG to 1' E. Con0e-t a +ate to a cha-acte- eA,-ession 4. Con0e-t a cha-acte- eA,-ession to a +ate #ns8e-: C/ E 1(. 2hich t8o a-e cha-acte- mani,ulation 1unctions3 Choose t8o." #. TRIM B. RE)L#CE C. TRUNC D. TO_D#TE E. MOD 4. C#SE #ns8e-: #/ B 1D. 2hich SELECT statement shoul+ ;ou use to eAt-act the ;ea- 1-om the s;stem +ate an+ +is,la; it in the 1o-mat .1KKJ.3 #. SELECT TO_C%#R S*SD#TE/7;;;;7" 4ROM +ual5 B. SELECT TO_D#TE S*SD#TE/7;;;;7" 4ROM +ual5 C. SELECT DECODE SUBSTR S*SD#TE/ J"/ 7****7" 4ROM +ual5 D. SELECT DECODE SUBSTR S*SD#TE/ J"/ 7;ea-7" 4ROM +ual5 E. SELECT TO_C%#R SUBSTR S*SD#TE/ J/&"/7;;;;7" 4ROM +ual5 #ns8e-: # 2hich th-ee SELECT statements +is,la;s &''' in the 1o-mat HL&/'''.''I3 Choose th-ee" #. SELECT TO_C%#R &'''/ FLX/XXX.XXG" 4ROM +ual5 B. SELECT TO_C%#R &'''/ FL'/'''.''G" 4ROM +ual5 C. SELECT TO_C%#R &'''/ FLK/KKK.''G" 4ROM +ual5 D. SELECT TO_C%#R &'''/ FLK/KKK.KKG" 4ROM +ual5 E. SELECT TO_C%#R &'''/ FL&/'''.''G" 4ROM +ual5 4. SELECT TO_C%#R &'''/ FLN/NNN.NNG" 4ROM +ual5 #ns8e-: B/ C/ D

Page 19 of 81
Lesson !: Poinin: Tables 1. EAamine the st-uctu-e o1 the EM)LO*EES an+ DE)#RTMENTS tables: EM)LO*EES EM)LO*EE_ID DE)#RTMENT_ID M#N#NER_ID L#ST_N#ME DE)#RTMENTS DE)#RTMENT_ID M#N#NER_ID DE)#RTMENT_N#ME LOC#TION_ID NUMBER NUMBER NUMBER $#RC%#R& &(" NUMBER NUMBER $#RC%#R& 9(" NUMBER

*ou 8ant to c-eate a -e,o-t +is,la;in: em,lo;ee last names/ +e,a-tment names/ an+ locations. 2hich Mue-; shoul+ ;ou use to c-eate an eMuiO=oin3 #. SELECT last_name/ +e,a-tment_name/ location_i+ 4ROM em,lo;ees / +e,a-tments 5 B. SELECT em,lo;ees.last_name/ +e,a-tments.+e,a-tment_name/ +e,a-tments.location_i+ 4ROM em,lo;ees e/ +e,a-tments D 2%ERE e.+e,a-tment_i+ C+.+e,a-tment_i+5 C. SELECT e.last_name/ +.+e,a-tment_name/ +.location_i+ 4ROM em,lo;ees e/ +e,a-tments D 2%ERE mana:e-_i+ Cmana:e-_i+5 D. SELECT e.last_name/ +.+e,a-tment_name/ +.location_i+ 4ROM em,lo;ees e/ +e,a-tments D 2%ERE e.+e,a-tment_i+ C+.+e,a-tment_i+5 #ns8e-: D &. In 8hich t8o cases 8oul+ ;ou use an oute- =oin3 Choose t8o." #. The tables bein: =oine+ ha0e NOT NULL columns. B. The tables bein: =oine+ ha0e onl; matche+ +ata. C. The columns bein: =oine+ ha0e NULL 0alues. D. The tables bein: =oine+ ha0e onl; unmatche+ +ata. E. The tables bein: =oine+ ha0e both matche+ an+ unmatche+ +ata. 4. Onl; 8hen the tables ha0e a ,-ima-; <e;V1o-ei:n <e; -elationshi,. #ns8e-: C/ E 9. *ou 8ant to -et-ie0e all em,lo;eesG last names/ alon: 8ith thei- mana:e-Gs last names an+ thei- +e,a-tment names. 2hich Mue-; 8oul+ ;ou use3 #. SELECT last_name/ mana:e-_i+/ +e,a-tment_name 4ROM em,lo;ees e 4ULL OUTER POIN +e,a-tments + ON e.+e,a-tment_i+ C +.+e,a-tment_i+"5

Page 20 of 81
B. SELECT e.last_name/ m.last_name/ +e,a-tment_name 4ROM em,lo;ees e LE4T OUTER POIN em,lo;ees m on e.mana:ae-_i+ C m.em,lo;ee_i+" LE4T OUTER POIN +e,a-tments + ON e.+e,a-tment_i+ C +.+e,a-tment_i+"5 C. SELECT e.last_name/ m.last_name/ +e,a-tment_name 4ROM em,lo;ees e RINT OUTER POIN em,lo;ees m on e.mana:e-_i+ C m.em,lo;ee_i+" LE4T OUTER POIN +e,a-tments + ON e.+e,a-tment_i+ C +.+e,a-tment_i+"5 D. SELECT e.last_name/ m.last_name/ +e,a-tment_name 4ROM em,lo;ees e LE4T OUTER POIN em,lo;ees m on e.mana:e-_i+ C m.em,lo;ee_i+" RINT OUTER POIN +e,a-tments + ON e.+e,a-tment_i+ C +.+e,a-tment_i+"5 E. SELECT e.last_name/ m.last_name/ +e,a-tment_name 4ROM em,lo;ees e RIN%T OUTER POIN em,lo;ees m on e.mana:e-_i+ C m.em,lo;ee_i+" RIN%T OUTER POIN +e,a-tments + ON e.+e,a-tment_i+ C +.+e,a-tment_i+"5 4. SELECT last_name/ mana:e-_i+/ +e,a-tment_name 4ROM em,lo;ees e POIN +e,a-tments + ON e.+e,a-tment_i+ C +.+e,a-tment_i+" 5 #ns8e-: B !.

The COMMISSION column sho8s the monthl; commission ea-ne+ b; the em,lo;ee. 2hich t8o tas<s 8oul+ -eMui-e subMue-ies o- =oins in o-+e- to be ,e-1o-me+ in a sin:le ste,3 Choose t8o." #. listin: the em,lo;ees 8ho ea-n the same amount o1 commission as em,lo;ee 9 B. 1in+in: the total commission ea-ne+ b; the em,lo;ees in +e,a-tment 1' C. 1in+in: the numbe- o1 em,lo;ees 8ho ea-n a commission that is hi:he- than the a0e-a:e commission o1 the com,an; D. listin: the +e,a-tments 8hose a0e-a:e commission is mo-e that D'' E. listin: the em,lo;ees 8ho +o not ea-n commission an+ 8ho a-e 8o-<in: 1o+e,a-tment &' in +escen+in: o-+e- o1 the em,lo;ee ID 4. listin: the em,lo;ees 8hose annual commission is mo-e than D''' #ns8e-: #/ C (. EAamine the +ata in the EM)LO*EES an+ DE)#RTMENTS tables.

Page 21 of 81
EM)LO*EES L#ST_N#ME Net@ Da0is Sin: Da0is SochhaDE)#RTMENTS DE)#RTMENT_ID 1' &' 9' !' DE)#RTMENT_ID 1' &' &' 9' 9''' 1('' &&'' (''' (''' S#L#R*

DE)#RTMENT_N#ME Sales Ma-<etin: #ccounts #+minist-ation

*ou 8ant to -et-ie0e all em,lo;ees/ 8hethe- o- not the; ha0e matchin: +e,a-tments in the +e,a-tments table. 2hich Mue-; 8oul+ ;ou use3 #. SELECT last_name/ +e,a-tment_name 4ROM em,lo;ees / +e,a-tments B"5 B. SELECT last_name/ +e,a-tment_name 4ROM em,lo;ees POIN +e,a-tments B"5 C. SELECT last_name/ +e,a-tment_name 4ROM em,lo;ees B" e POIN +e,a-tments + ON e.+e,a-tment_i+ C +.+e,a-tment_i+"5 D. SELECT last_name/ +e,a-tment_name 4ROM em,lo;ees e RIN%T OUTER POIN +e,a-tments + ON e.+e,a-tment_i+ C +.+e,a-tment_i+"5 E. SELECT last_name/ +e,a-tment_name 4ROM em,lo;ees B" / +e,a-tments ON e.+e,a-tment_i+ C +.+e,a-tment_i+"5 4. SELECT last_name/ +e,a-tment_name 4ROM em,lo;ees e LE4T OUTER POIN +e,a-tments + ON e.+e,a-tment_i+ C +.+e,a-tment_i+"5 #ns8e-: 4 D. EAamine the st-uctu-e o1 the EM)LO*EES an+ DE)#RTMENTS tables:
EM)LO*EES Column name EM)LO*EE_ID EM)_N#ME POB_ID S#L#R* MNR_ID DE)#RTMENT ID Data t;,e NUMBER $#RC%#R& 9'" $#RC%#R& &'" NUMBER NUMBER NUMBER Rema-<s NOT NULL/ )-ima-; Se;

Re1e-ences EM)LO*EE_ID COLUMN 4o-ei:n <e; to DE)#RTMENT ID column o1 the DE)#RTMENTS table Rema-<s NOT NULL/ )-ima-; Se; Re1e-ences MNR_ID column o1 the EM)LO*EES table

DE)#RTMENTS Column name Data t;,e DE)#RTMENT_ID NUMBER DE)#RTMENT_N#ME $#RC%#R& 9'" MNR_ID NUMBER

E0aluate this S>L statement: SELECT em,lo;ee_i+/ e.+e,a-tment_i+/ +e,a-tment_name/ Sala-; 4ROM em,lo;ees e/ +e,a-tments + 2%ERE e.+e,a-tment_i+ C +.+e,a-tment_i+5

Page 22 of 81
2hich S>L statement is eMui0alent to the abo0e S>L statement3 #. SELECT em,lo;ee_i+/ +e,a-tment_i+/ +e,a-tment_name/ Sala-; 4ROM em,lo;ees 2%ERE +e,a-tment_i+ IN SELECT +e,a-tment_i+ 4ROM +e,a-tments"5 B. SELECT em,lo;ee_i+/ +e,a-tment_i+/ +e,a-tment_name/ Sala-; 4ROM em,lo;ees N#TUR#L POIN +e,a-tments5 C. SELECT em,lo;ee_i+/ +.+e,a-tment_i+/ +e,a-tment_name/ Sala-; 4ROM em,lo;ees e POIN +e,a-tments + ON e.+e,a-tment_i+ C +.+e,a-tment_i+5 D. SELECT em,lo;ee_i+/ +e,a-tment_i+/ +e,a-tment_name/ Sala-; 4ROM em,lo;ees POIN +e,a-tments USINN e.+e,a-tment_i+/ +.+e,a-tment_i+"5 #ns8e-: C E. EAamine the +esc-i,tion o1 the M#RSS table: STD_ID STUDENT_N#ME SUBP1 SUBP& NUMBER !" $#RC%#R& 9'" NUMBER 9" NUMBER 9"

SUBP1 an+ SUBP& in+icate the ma-<s obtaine+ b; a stu+ent in t8o sub=ects. EAamine this SELECT statement base+ on the M#RSS table: SELECT sub=1Bsub=& total_ma-<s/ st+_i+ 4ROM ma-<s 2%ERE sub=1 Q #$N sub=1" #ND sub=& Q #$N sub=&" ORDER B* total_ma-<s5 2hat is the -esult o1 the SELECT statement3 #. The statement eAecutes success1ull; an+ -etu-ns the stu+ent ID an+ sum o1 all ma-<s 1o- each stu+ent 8ho obtaine+ mo-e than the a0e-a:e ma-< in each sub=ect. B. The statement -etu-ns an e--o- at the SELECT clause. C. The statement -etu-ns an e--o- at the 2%ERE clause. D. The statement -etu-ns an e--o- at the ORDER B* clause. #ns8e-: C J. EAamine the st-uctu-e o1 the EM)LO*EES/ DE)#RTMENTS/ an+ LOC#TIONS tables. EM)LO*EES EM)LO*EE_ID EM)_N#ME POB_ID NUMBER $#RC%#R& 9'" $#RC%#R& &'" NOT NULL/ )-ima-; Se;

Page 23 of 81
S#L#R* NUMBER MNR_ID NUMBER DE)#RTMENT_ID NUMBER DE)#RTMENTS DE)#RTMENT_ID DE)#RTMENT_N#ME MNR_ID LOC#TION_ID LOC#TIONS LOC#TION_ID CIT* Re1e-ences EM)LO*EE_ID column 4o-ei:n <e; to DE)#RTMENT_ID column o1 the DE)#RTMENTS table NOT NULL/ )-ima-; Se; Re1e-ences NNR_ID column o1 the EM)LO*EES table 4o-ei:n <e; to LOC#TION_ID column o1 the LOC#TIONS table NOT NULL/ )-ima-; Se;

NUMBER $#RC%#R& 9'" NUMBER NUMBER

NUMBER $#RC%#R& 9'"

2hich t8o S>L statements ,-o+uce the name/ +e,a-tment name/ an+ the cit; o1 all the em,lo;ees 8ho ea-n mo-e then 1''''3 Choose t8o" #. SELECT em,_name/ +e,a-tment_name/ cit; 4ROM em,lo;ees e POIN +e,a-tments + USINN +e,a-tment_i+" POIN locations 1 USINN location_i+" 2%ERE sala-; Q 1''''5 B. SELECT em,_name/ +e,a-tment_name/ cit; 4ROM em,lo;ees e/ +e,a-tments +/ locations 1 POIN ON e.+e,a-tment_i+ C +.+e,a-tment i+" #ND +.location_i+ C1.location_i+" #ND sala-; Q 1''''5 C. SELECT em,_name/ +e,a-tment_name/ cit; 4ROM em,lo;ees e/ +e,a-tments +/ locations 1 2%ERE sala-; Q 1''''5 D. SELECT em,_name/ +e,a-tment_name/ cit; 4ROM em,lo;ees e/ +e,a-tments +/ locations 1 2%ERE e.+e,a-tment_i+ C +.+e,a-tment_i+ #ND +.location_i+ C 1.location_i+ #ND sala-; Q 1''''5 E. SELECT em,_name/ +e,a-tment_name/ cit; 4ROM em,lo;ees e N#TUR#L POIN +e,a-tments/ locations 2%ERE sala-; Q 1''''5 #ns8e-: #/ D K. The STUDENT_NR#DES table has these columns:

Page 24 of 81
STUDENT_ID SEMESTER_END N)# NUMBER 1&" D#TE NUMBER !/9"

The -e:ist-a- has as<e+ 1o- a -e,o-t on the a0e-a:e :-a+e ,oint a0e-a:e N)#" 1ostu+ents en-olle+ +u-in: semeste-s that en+ in the ;ea- &'''. 2hich statement accom,lish this3 #. SELECT #$ER#NE :,a" 4ROM stu+ent_:-a+es 2%ERE semeste-_en+ Q G'1OP#NO&'''G an+ semeste- en+ R 91ODECO&'''G5 B. SELECT COUNT :,a" 4ROM stu+ent :-a+es 2%ERE semeste-_en+ Q G'1OP#NO&'''G an+ semeste- en+ R G91ODECO&'''G5 C. SELECT MIN :,a" 4ROM stu+ent :-a+es 2%ERE semeste-_en+ Q G'1OP#NO&'''G an+ semeste- en+ R G91ODECO&'''G5 D. SELECT #$N :,a" 4ROM stu+ent_:-a+es 2%ERE semeste-_en+ BET2EEN G'1OP#NO&'''G an+ G91.DEC.&'''G5 E. SELECT SUM :,a" 4ROM stu+ent :-a+es 2%ERE semeste-_en+ Q G'1OP#NO&'''G an+ semeste- en+ R G91ODECO&'''G5 4. SELECT MEDI#N :,a" 4ROM stu+ent_:-a+es 2%ERE semeste- en+ Q G'1OP#NO&'''G an+ semeste- en+ R G91ODECO&'''G5 #ns8e-: D 1'. EAamine the +ata o1 the EM)LO*EES table. EM)LO*EES EM)LO*EE_ID is the ,-ima-; <e;. MNR_ID is the ID o1 mana:e-s an+ -e1e-s to the EM)LO*EE_ID"

EM)LO*EE_ID 1'1 1'& 1'9 1'! 1'( 1'D 1'J 11' 1&'

EM)_N#ME Smith Ma-tin Ch-is Pohn Diana B-;an Penni1eBob Ra0i

DE)T_ID &' 1' &' 9' 9' !' 9' !' &'

MNR_ID 1&' 1'( 1&' 1'J 1'J 11' 11' 11'

POB_ID S#_RE) CLERS IT_#DMIN %R_CLERS %R_MNR #D_#SST %R_DIR EW_DIR S#_DIR

S#L#R* !''' &('' !&'' &('' (''' 9''' D('' J''' D(''

Page 25 of 81
2hich statement lists the ID/ name/ an+ sala-; o1 the em,lo;ee/ an+ the ID an+ name o1 the em,lo;ee7s mana:e-/ 1o- all the em,lo;ees 8ho ha0e a mana:e- an+ ea-n mo-e than !'''3 #. SELECT em,lo;ee_i+ .Em,_i+./ em,_name .Em,lo;ee./ sala-;/ em,lo;ee_i+ .M:-_i+./ em,_name .Mana:e-. 4ROM em,lo;ees 2%ERE sala-; Q !'''5 B. SELECT e.em,lo;ee_i+ .Em,_i+./ e.em,_name .Em,lo;ee./ e.sala-;/ m.em,lo;ee_i+ .M:-_i+./ m.em,_name .Mana:e-. 4ROM em,lo;ees e/ em,lo;ees m 2%ERE e.m:-_i+ C m.m:-_i+ #ND e.sala-; Q !'''5 C. SELECT e.em,lo;ee_i+ .Em,_i+./ e.em,_name .Em,lo;ee./ e.sala-;/ m.em,lo;ee_i+ .M:-_i+./ m.em,_name .Mana:e-. 4ROM em,lo;ees e/ em,lo;ees m 2%ERE e.m:-_i+ C m.em,lo;ee_i+ #ND e.sala-; Q !'''5 D. SELECT e.em,lo;ee_i+ .Em,_i+./ e.em,_name .Em,lo;ee./ e.sala-;/ m.m:-_i+ .M:-_i+./ m.em,_name .mana:e-. 4ROM em,lo;ees e/ em,lo;ees m 2%ERE e.m:-_i+ C m.em,lo;ee_i+ #ND e.sala-; Q !'''5 E. SELECT e.em,lo;ee_i+ .Em,_i+./ e.em,_name .Em,lo;ee./ e.sala-;/ m.m:-_i+ .M:-_i+./ m.em,_name .Mana:e-. 4ROM em,lo;ees e/ em,lo;ees m 2%ERE e.em,lo;ee_i+ C m.em,lo;ee_i+ #ND e.sala-; Q !'''5 #ns8e-: C 11. EAamine the +ata o1 the EM)LO*EES table. EM)LO*EES EM)LO*EE_ID is the ,-ima-; <e;. MNR_ID is the ID o1 mana:e-s an+ -e1e-s to the EM)LO*EE_ID"

EM)LO*EE_ID 1'1 1'& 1'9 1'! 1'( 1'D 1'J 11' 1&' POB_ID Smith Ma-tin Ch-is Pohn Diana B-;an Penni1eBob Ra0i

EM)_N#ME S#L#R* &' 1' &' 9' 9' !' 9' !' &'

DE)T_ID 1&' 1'( 1&' 1'J 1'J 11' 11' 11' S#_RE) CLERS IT_#DMIN %R_CLERS %R_MNR #D_#SST %R_DIR EW_DIR S#_DIR

MNR_ID !''' &('' !&'' &('' (''' 9''' D('' J''' D(''

E0aluate this S>L statement:

Page 26 of 81
SELECT e.em,lo;ee_i+ .Em,_i+./ e.em,_name .Em,lo;ee./ e.sala-;/ m.em,lo;ee_i+ .M:-_i+./ m.em,_name .Mana:e-. 4ROM em,lo;ees e/ em,lo;ees m 2%ERE e.m:-_i+ C m.em,lo;ee_i+ #ND e.sala-; Q !'''5 2hat is its out,ut3 #. EM)_i+ 11' 1&' 1'J 1'9 1'( B. EM)_i+ 1&' 1'J 1'9 1'( C. EM)_i+ 11' 1&' 1'J 1'9 1'( D EM)_i+ 11' 1&' 1'J 1'9 1'( EM)LO*EE Bob Ra0i Penni1eCh-is Diana EM)LO*EE Ra0i Penni1eCh-is Diana EM)LO*EE Bob Ra0i Penni1eCh-is Diana EM)LO*EE Bob Ra0i Penni1eCh-is Diana S#L#R* J''' D('' D('' !&'' (''' S#L#R* D('' D('' !&'' (''' S#L#R* J''' D('' D('' !&'' (''' S#L#R* J''' D('' D('' !&'' (''' M:-_i+ 11' 11' 1&' 1'J M:-_i+ 11' 11' 1&' 1'J M:-_i+ 11' 11' 1&' 1'J M:-_i+ 11' 1&' 1'J 1'9 1'( Mana:eBob Ra0i Penni1eCh-is Diana Mana:eBob Bob Ra0i Penni1eMana:eBob Bob Ra0i Penni1eMana:eBob Ra0i Penni1eCh-is Dina

E. The S>L statement ,-o+uces an e--o-. #ns8e-: B 1&. In 8hich case 8oul+ ;ou use a 4ULL OUTER POIN3 #. Both tables ha0e NULL 0alues. B. *ou 8ant all unmatche+ +ata 1-om one table. C. *ou 8ant all matche+ +ata 1-om both tables. D. *ou 8ant all unmatche+ +ata 1-om both tables. E. One o1 the tables has mo-e +ata than the othe-. 4. *ou 8ant all matche+ an+ unmatche+ +ata 1-om onl; one table.

Page 27 of 81
#ns8e-: D 19. EAamine the st-uctu-es o1 the EM)LO*EES an+ T#W tables. EM)LO*EES EM)LO*EE_ID EM)_N#ME POB_ID S#L#R* MNR_ID DE)#RTMENT_ID T#W MIN_S#L#R* M#W_S#L#R* T#W_)ERCENT NUMBER $#RC%#R& 9'" $#RC%#R& &'" NUMBER NUMBER NUMBER NOT NULL/ )-ima-; Se;

Re1e-ences EM)LO*EE_ID column 4o-ei:n <e; to DE)#RTMENT_ID column o1 the DE)#RTMENTS table

NUMBER NUMBER NUMBER

)e-centa:e taA 1o- :i0en sala-; -an:e

*ou nee+ to 1in+ the ,e-centa:e taA a,,licable 1o- each em,lo;ee. 2hich S>L statement 8oul+ ;ou use3 #. SELECT em,lo;ee_i+/ sala-;/ taA_,e-cent 4ROM em,lo;ees e/ taA t 2%ERE e.sala-; BET2EEN t.min_sala-; #ND t.maA_sala-;5

B. SELECT em,lo;ee_i+/ sala-;/ taA_,e-cent 4ROM em,lo;ees e/ taA t 2%ERE e.sala-; Q t.min_sala-;/ taA_,e-cent5 C. SELECT em,lo;ee_i+/ sala-;/ taA_,e-cent 4ROM em,lo;ees e/ taA t 2%ERE MIN e.sala-;" C t.min_sala-; #ND M#W e.sala-;" C t.maA_sala-; D. *ou cannot 1in+ the in1o-mation because the-e is no common column bet8een the t8o tables. #ns8e-: # 1!. EAamine the st-uctu-e o1 the EM)LO*EES/ DE)#RTMENTS/ an+ T#W tables. EM)LO*EES EM)LO*EE_ID EM)_N#ME POB_ID S#L#R* MNR_ID DE)#RTMENT_ID NUMBER $#RC%#R& 9'" $#RC%#R& &'" NUMBER NUMBER NUMBER NOT NULL/ )-ima-; Se;

Re1e-ences EM)LO*EE_ID column 4o-ei:n <e; to DE)#RTMENT_ID column o1 the DE)#RTMENTS table

Page 28 of 81
DE)#RTMENTS DE)#RTMENT_ID DE)#RTMENT_N#ME MNR_ID NUMBER $#RC%#R& 9'" NUMBER NOT NULL/ )-ima-; Se; Re1e-ences MNR_ID column o1 the EM)LO*EES table

T#W MIN_S#L#R* NUMBER M#W_S#L#R* NUMBER T#W_)ERCENT NUMBER 4o- 8hich situation 8oul+ ;ou use a noneMui=oin Mue-;3 #. To 1in+ the taA ,e-centa:e 1o- each o1 the em,lo;ees. B. To list the name/ =ob i+/ an+ mana:e- name 1o- all the em,lo;ees. C. To 1in+ the name/ sala-;/ an+ +e,a-tment name o1 em,lo;ees 8ho a-e not 8o-<in: 8ith Smith. D. To 1in+ the numbe- o1 em,lo;ees 8o-<in: 1o- the #+minist-ati0e +e,a-tment an+ ea-nin: less then !'''. E. To +is,la; name/ sala-;/ mana:e- ID/ an+ +e,a-tment name o1 all the em,lo;ees/ e0en i1 the em,lo;ees +o not ha0e a +e,a-tment ID assi:ne+. #ns8e-: # 1(. 2hat is t-ue about =oinin: tables th-ou:h an eMui=oin3 #. *ou can =oin a maAimum o1 t8o tables th-ou:h an eMui=oin. B. *ou can =oin a maAimum o1 t8o columns th-ou:h an eMui=oin. C. *ou s,eci1; an eMui=oin con+ition in the SELECT o- 4ROM clauses o1 a SELECT statement. D. To =oin t8o tables th-ou:h an eMui=oin/ the columns in the =oin con+ition must be ,-ima-; <e; an+ 1o-ei:n <e; columns. E. *ou can =oin n tables all ha0in: sin:le column ,-ima-; <e;s" in a S>L statement b; s,eci1;in: a minimum o1 nO1 =oin con+itions. #ns8e-: E 1D. 2hich th-ee a-e t-ue -e:a-+in: the use o1 oute- =oins3 Choose th-ee." #. *ou cannot use IN o,e-ato- in a con+ition that in0ol0es an oute-=oin. B. *ou use B" on both si+es o1 the 2%ERE con+ition to ,e-1o-m an oute-=oin. C. *ou use ?" on both si+es o1 the 2%ERE con+ition to ,e-1o-m an oute-=oin. D. *ou use an oute-=oin to see the -o8s that +o not meet the =oin con+ition. E. In the 2%ERE con+ition/ ;ou use B" 1ollo8in: the name o1 the column in the table 8ithout matchin: -o8s/ to ,e-1o-m an oute-=oin. 4. *ou cannot lin< a con+ition that is in0ol0e+ in an oute-=oin to anothe- con+ition b; usin: the OR o,e-ato-. #ns8e-: D/ E/ 4

Page 29 of 81
Lesson (: N-ou, 4unctions 1. EAamine the +esc-i,tion o1 the STUDENTS table: STD_ID NUMBER !" COURSE_ID $#RC%#RD& 1'" ST#RT_D#TE D#TE END_D#TE D#TE 2hich t8o a::-e:ate 1unctions a-e 0ali+ on the ST#RT_D#TE column3 Choose t8o" #. SUM sta-t_+ate" B. #$N sta-t_+ate" C. COUNT sta-t_+ate" D. #$N sta-t_+ate/ en+_+ate" E. MIN sta-t_+ate" 4. M#WIMUM sta-t_+ate" #ns8e-: C/ E &. EAamine the +esc-i,tion o1 the EM)LO*EES table: EM)_ID NUMBER !" NOT NULL L#ST_N#ME $#RC%#R& 9'" NOT NULL 4IRST_N#ME $#RC%#R& 9'" DE)T_ID NUMBER &" POB_C#T $#RC%#R& 9'" S#L#R* NUMBER J/&" 2hich statement sho8s the +e,a-tment ID/ minimum sala-;/ an+ maAimum sala-; ,ai+ in that +e,a-tment/ onl; o1 the minimum sala-; is less then (''' an+ the maAimum sala-; is mo-e than 1('''3 #. SELECT +e,t_i+/ MIN sala-; / M#W sala-;" 4ROM em,lo;ees 2%ERE MIN sala-;" R (''' #ND M#W sala-;" Q 1('''5 B. SELECT +e,t_i+/ MIN sala-;"/ M#W sala-;" 4ROM em,lo;ees 2%ERE MIN sala-;" R (''' #ND M#W sala-;" Q 1(''' NROU) B* +e,t_i+5 C. SELECT +e,t_i+/ MIN sala-;"/ M#W sala-;" 4ROM em,lo;ees %#$INN MIN sala-;" R (''' #ND M#W sala-;" Q 1('''5 D. SELECT +e,t_i+/ MIN sala-;"/ M#W sala-;" 4ROM em,lo;ees NROU) B* +e,t_i+ %#$INN MIN sala-;" R (''' #ND M#W sala-;" E. SELECT +e,t_i+/ MIN sala-;"/ M#W sala-;" 4ROM em,lo;ees

Q 1('''5

Page 30 of 81
NROU) B* +e,t_i+/ sala-; %#$INN MIN sala-;" R (''' #ND M#W sala-;" Q 1('''5 #ns8e-: D 9. 2hich t8o a-e t-ue about a::-e:ate 1unctions3 Choose t8o." #. *ou can use a::-e:ate 1unctions in an; clause o1 a SELECT statement. B. *ou can use a::-e:ate 1unctions onl; in the column list o1 the SELECT clause an+ in the 2%ERE clause o1 a SELECT statement. C. *ou can miA sin:le -o8 columns 8ith a::-e:ate 1unctions in the column list o1 a SELECT statement b; :-ou,in: on the sin:le -o8 columns. D. *ou can ,ass column names/ eA,-essions/ constants/ o- 1unctions as ,a-amete-s to an a::-e:ate 1unction. E. *ou can use a::-e:ate 1unctions on a table/ onl; b; :-ou,in: the 8hole table as one sin:le :-ou,. 4. *ou cannot :-ou, the -o8s o1 a table b; mo-e than one column 8hile usin: a::-e:ate 1unctions. #ns8e-: C/ D !. The CUSTOMERS table has these columns: CUSTOMER_ID CUSTOMER_N#ME STREET_#DDRESS CIT*_#DDRESS ST#TE_#DDRESS )RO$INCE_#DDRESS COUNTR*_#DDRESS )OST#L_CODE CUSTOMER_)%ONE NUMBER !" NOT NULL $#RC%#R& 1''" NOT NULL $#RC%#R& 1('" $#RC%#R& ('" $#RC%#R& ('" $#RC%#R& ('" $#RC%#R& ('" $#RC%#R& 1&" $#RC%#R& &'"

The CUSTOMER_ID column is the ,-ima-; <e; 1o- the table. 2hich t8o statements 1in+ the numbe- o1 custome-s3 Choose t8o." #. SELECT TOT#L ?" 4ROM custome-s5 B. SELECT COUNT ?" 4ROM custome-s5 C. SELECT TOT#L custome-_i+" 4ROM custome-s5 D. SELECT COUNT custome-_i+" 4ROM custome-s5 E. SELECT COUNT custome-s" 4ROM custome-s5 4. SELECT TOT#L custome-_name" 4ROM custome-s5 #ns8e-: B/ D (. *ou nee+ to calculate the total o1 all sala-ies in the accountin: +e,a-tment. 2hich :-ou, 1unction shoul+ ;ou use3 #. M#W B. MIN C. SUM D. COUNT E. TOT#L

Page 31 of 81
4. L#RNEST #ns8e-: C D. 2hich clause shoul+ ;ou use to eAclu+e :-ou, -esults3 #. 2%ERE B. %#$INN C. RESTRICT D. NROU) B* E. ORDER B* #ns8e-: B E. 2hich t8o statements a-e t-ue about 2%ERE an+ %#$INN clauses3 Choose t8o" #. # 2%ERE clause can be use+ to -est-ict both -o8s an+ :-ou,s. B. # 2%ERE clause can be use+ to -est-ict -o8s onl;. C. # %#$INN clause can be use+ to -est-ict both -o8s an+ :-ou,s. D. # %#$INN clause can be use+ to -est-ict :-ou,s onl;. E. # 2%ERE clause C#NNOT be use+ in a Mue-; o1 the Mue-; uses a %#$INN clause. 4. # %#$INN clause C#NNOT be use+ in subMue-ies. #ns8e-: B/ C J. EAamine the +esc-i,tion o1 the EM)LO*EES table: EM)_ID L#ST_N#ME 4IRST_N#ME DE)T_ID NUMBER !" NOT NULL $#RC%#R& 9'" NOT NULL $#RC%#R& 9'" NUMBER &"

2hich statement ,-o+uces the numbe- o1 +i11e-ent +e,a-tments that ha0e em,lo;ees 8ith last name Smith3 #. SELECT COUNT ?" 4ROM em,lo;ees 2%ERE last_nameC7Smith75 B. SELECT COUNT +e,t_i+" 4ROM em,lo;ees 2%ERE last_nameC7Smith75 C. SELECT DISTINCT COUNT +e,t_i+"" 4ROM em,lo;ees 2%ERE last_nameC7Smith75 D. SELECT COUNT DISTINCT +e,t_i+" 4ROM em,lo;ees 2%ERE last_nameC7Smith75 E. SELECT UNI>UE +e,t_i+" 4ROM em,lo;ees 2%ERE last_nameC7Smith75 #ns8e-: D K. 2hat is t-ue o1 usin: :-ou, 1unctions on columns that contain NULL 0alues3 #. N-ou, 1unctions on columns i:no-e NULL 0alues. B. N-ou, 1unctions on columns -etu-nin: +ates inclu+e NULL 0alues. C. N-ou, 1unctions on columns -etu-nin: numbe-s inclu+e NULL 0alues. D. N-ou, 1unctions on columns cannot be accu-atel; use+ on columns that contain NULL 0alues. E. N-ou, 1unctions on columns inclu+e NULL 0alues in calculations i1 ;ou use the <e;8o-+ INC_NULLS.

Page 32 of 81
#ns8e-: # 1'. The STUDENT_NR#DES table has these columns: STUDENT_ID SEMESTER_END N)# NUMBER 1&" D#TE NUMBER !/9"

2hich statement 1in+s the hi:hest :-a+e ,oint a0e-a:e N)#" ,e- semeste-3 #. SELECT M#W :,a" 4ROM stu+ent_:-a+es 2%ERE :,a IS NOT NULL5 B. SELECT :,a" 4ROM stu+ent_:-a+es NROU) B* semeste-_en+ 2%ERE :,a IS NOT NULL5 C. SELECT M#W :,a" 4ROM stu+ent_:-a+es 2%ERE :,a IS NOT NULL NROU) B* semeste-_en+5 D. SELECT M#W :,a" NROU) B* semeste-_en+ 2%ERE :,a IS NOT NULL 4ROM stu+ent_:-a+es5 E. SELECT M#W :,a" 4ROM stu+ent_:-a+es NROU) B* semeste-_en+ 2%ERE :,a IS NOT NULL5 #ns8e-: C 11. *ou nee+ to 8-ite a S>L statement that -etu-ns em,lo;ee name/ sala-;/ +e,a-tment ID/ an+ maAimum sala-; ea-ne+ in the +e,a-tment o1 the em,lo;ee 1o- all em,lo;ees 8ho ea-n less than the maAimum sala-; in thei- +e,a-tment. 2hich statement accom,lishes this tas<3 #. SELECT a.em,_name/ a.sal/ b.+e,t_i+/ M#W sal" 4ROM em,lo;ees a/ +e,a-tments b 2%ERE a.+e,t_i+ C b.+e,t_i+ #ND a.sal R M#W sal" NROU) B* b.+e,t_i+5 B. SELECT a.em,_name/ a.sal/ a.+e,t_i+/ b.maAsal 4ROM em,lo;ees a/ SELECT +e,t_i+/ M#W sal" maAsal 4ROM em,lo;ees NROU) B* +e,t_i+" b 2%ERE a.+e,t_i+ C b.+e,t_i+ #ND a.sal R b.maAsal5 C. SELECT a.em,_name/ a.sal/ a.+e,t_i+/ b.maAsal 4ROM em,lo;ees a 2%ERE a.sal R SELECT M#W sal" maAsal 4ROM em,lo;ees b NROU) B* +e,t_i+"5 D. SELECT em,_name/ sal/ +e,t_i+/ maAsal 4ROM em,lo;ees/ SELECT +e,t_i+/ M#W sal" maAsal 4ROM em,lo;ees NROU) B* +e,t_i+" 2%ERE a.sal R maAsal5 #ns8e-: B 19. 2hich clause 8oul+ ;ou use in a SELECT statement to limit the +is,la; to those em,lo;ees 8hose sala-; is :-eate- then ('''3 #. ORDER B* S#L#R* Q (''' B. NROU) B* S#L#R* Q (''' C. %#$INN S#L#R* Q (''' D. 2%ERE S#L#R* Q (''' #ns8e-: D

Page 33 of 81
1!. The CUSTOMERS table has these columns: CUSTOMER_ID CUSTOMER_N#ME STREET_#DDRESS CIT*_#DDRESS ST#TE_#DDRESS )RO$INCE_#DDRESS COUNTR*_#DDRESS )OST#L_CODE CUSTOMER_)%ONE NUMBER !" NOT NULL $#RC%#R& 1''" NOT NULL $#RC%#R& 1('" $#R%C#R& ('" $#RC%#R& ('" $#RC%#R& ('" $#RC%#R& ('" $#RC%#R& 1&" $#RC%#R& &'"

The CUSTOMER_ID column is the ,-ima-; <e; 1o- the table. *ou nee+ to +ete-mine ho8 +is,e-se+ ;ou- custome- base is. 2hich eA,-ession 1in+s the numbe- o1 +i11e-ent count-ies -e,-esente+ in the CUSTOMERS table3 #. COUNT U))ER count-;_a++-ess"" B. COUNT DI44 U))ER count-;_a++-ess""" C. COUNT UNI>UE U))ER count-;_a++-ess""" D. COUNT DISTINCT U))ER count-;_a++-ess" E. COUNT DISTINCT U))ER count-;_a++-ess""" #ns8e-: E 1(. EAamine the +esc-i,tion o1 the CUSTOMERS table: CUSTOMER_ID CUSTOMER_N#ME STREET_#DDRESS CIT*_#DDRESS ST#TE_#DDRESS )RO$INCE_#DDRESS COUNTR*_#DDRESS )OST#L_CODE CUSTOMER_)%ONE NUMBER !" NOT NULL $#RC%#R& 1''" NOT NULL $#RC%#R& 1('" $#RC%#R& ('" $#RC%#R& ('" $#RC%#R& ('" $#RC%#R& ('" $#RC%#R& 1&" $#RC%#R& &'"

The CUSTOMER_ID column is the ,-ima-; <e; 1o- the table. 2hich statement -etu-ns the cit; a++-ess an+ the numbe- o1 custome-s in the cities Los #n:eles o- San 4-ancisco3 #. SELECT cit;_a++-ess/ COUNT ?" 4ROM custome-s 2%ERE cit;_a++-ess IN 7Los #n:eles7/ 7San 4-ancisco7"5 B. SELECT cit;_a++-ess/ COUNT ?" 4ROM custome-s 2%ERE cit;_a++-ess IN 7Los #n:eles7/ 7San 4-ancisco7" NROU) B* cit;_a++-ess5 C. SELECT cit;_a++-ess/ COUNT custome-_i+" 4ROM custome-s 2%ERE cit;_a++-ess IN 7Los #n:eles7/ 7San 4-ancisco7" NROU) B* cit;_a++-ess/ custome-_i+5 D. SELECT cit;_a++-ess/ COUNT custome-_i+" 4ROM custome-s NROU) B* cit;_a++-ess IN 7Los #n:eles7/ 7San 4-ancisco7"5 #ns8e-: B Lesson D: SubMue-ies

Page 34 of 81
1. EAamine the +ata in the EM)LO*EES table: L#ST_N#ME Net@ Da0is Sin: Da0is DE)#RTMENT_ID 1' &' &' 9' 9''' 1('' &&'' (''' S#L#R*

2hich th-ee subMue-ies 8o-<3 Choose th-ee" #. SELECT ? 4ROM em,lo;ees 8he-e sala-; Q SELECT MIN sala-;" 4ROM em,lo;ees NROU) B* +e,a-tment.i+"5 B. SELECT ? 4ROM em,lo;ees 2%ERE sala-; C SELECT #$N sala-;" 4ROM em,lo;ees NROU) B* +e,a-tment_i+"5 C. SELECT +istinct +e,a-tment_i+ 4ROM em,lo;ees 2he-e sala-; Q #N* SELECT #$N sala-;" 4ROM em,lo;ees NROU) B* +e,a-tment_i+"5 D. SELECT +e,a-tment_i+ 4ROM em,lo;ees 2%ERE S#L#R* Q #LL SELECT #$N sala-;" 4ROM em,lo;ees NROU) B* +e,a-tment_i+"5 E. SELECT last_name 4ROM em,lo;ees 2he-e sala-; Q #N* SELECT M#W sala-;" 4ROM em,lo;ees NROU) B* +e,a-tment_i+"5 4. SELECT +e,a-tment_i+ 4ROM em,lo;ees 2%ERE sala-; Q #LL SELECT #$N sala-;" 4ROM em,lo;ees NROU) B* #$N S#L#R*""5 #ns8e-: C/ D/ E &. EAamine the +ata 1-om the ORDERS an+ CUSTOMERS table. ORDERS ORD_ID 1'' 1'1 1'& 1'9 1'! 1'( 1'D 1'E 1'J ORD_D#TE 1&OP#NO&''' 1( 'KOM#RO&''' 'KOM#RO&''' 1(OM#RO&''' &(OPUNO&''' 1JOPULO&''' 1JOPULO&''' &1OPULO&''' '!O#UNO&''' 1' CUST_N#ME CUST_ID 1'''' !' 9( 1( 1( &' 9( &' J''' CIT* J''' 1&('' 1&''' D''' (''' E''' D('' ORD_TOT#L

CUSTOMERS CUST_ID

Page 35 of 81
1' 1( &' &( 9' 9( !' Smith Bob Ma-tin Ma-; Rina Smith Lin+a Los #n:eles San 4-ancisco Chica:o Ne8 *o-< Chica:o Ne8 *o-< Ne8 *o-<

2hich S>L statement -et-ie0es the o-+e- ID/ custome- ID/ an+ o-+e- total 1o- the o-+e-s that a-e ,lace+ on the same +a; that Ma-tin ,laces his o-+e-s3 #. SELECT o-+_i+/ cust_i+/ o-+_total 4ROM o-+e-s/ custome-s 2%ERE cust_nameCGMatin:G #ND o-+_+ate IN G1JOPULO&'''G/G&1OPULO&'''G"5 B. SELECT o-+_i+/ cust_i+/ o-+_total 4ROM o-+e-s 2he-e o-+_+ate IN SELECT o-+_+ate 4ROM o-+e-s 2%ERE cust_i+ C SELECT cust_i+ 4ROM custome-s 2%ERE cust_name C FMa-tinG""5 C. SELECT o-+_i+/ cust_i+/ o-+_total 4ROM o-+e-s 2he-e o-+_+ate IN SELECT o-+_+ate 4ROM o-+e-s/ custome-s 2he-e cust_name C FMa-tinG"5 D. SELECT o-+_i+/ cust_i+/ o-+_total 4ROM o-+e-s 2%ERE cust_i+ IN SELECT cust_i+ 4ROM custome-s 2%ERE cust name C FMa-tinG"5 #ns8e-: B 9. E0aluate the S>L statement: 1 SELECT a.em,_name/ a.sal/ a.+e,t_i+/ b.maAsal & 4ROM em,lo;ees a/ 9 SELECT +e,t_i+/ M#W sal" maAsal !. 4ROM em,lo;ees ( NROU) B* +e,t_i+" b D 2%ERE a.+e,t_i+ C b.+e,t_i+ E #ND a.sal R b.maAsal5 2hat is the -esult o1 the statement3 #. The statement ,-o+uces an e--o- at line 1. B. The statement ,-o+uces an e--o- at line 9. C. The statement ,-o+uces an e--o- at line D. D. The statement -etu-ns the em,lo;ee name/ sala-;/ +e,a-tment ID/ an+ maAimum sala-; ea-ne+ in the +e,a-tment o1 the em,lo;ee 1o- all +e,a-tments that ,a; less sala-; then the maAimum sala-; ,ai+ in the com,an;. E. The statement -etu-ns the em,lo;ee name/ sala-;/ +e,a-tment ID/ an+ maAimum sala-; ea-ne+ in the +e,a-tment o1 the em,lo;ee 1o- all em,lo;ees 8ho ea-n less than the maAimum sala-; in thei- +e,a-tment.

Page 36 of 81
#ns8e-: E !. EAamine the st-uctu-e o1 the EM)LO*EES an+ NE2_EM)LO*EES tables: EM)LO*EES EM)LO*EE_ID 4IRST_N#ME L#ST_N#ME %IRE_D#TE NUMBER )-ima-; Se; $#RC%#RD& &(" $#RC%#RD& &(" D#TE

NE2 EM)LO*EES EM)LO*EE_ID NUMBER )-ima-; Se; N#ME $#RC%#R& D'" 2hich U)D#TE statement is 0ali+3 #. U)D#TE ne8_em,lo;ees SET name C Select last_name66 1i-st_name 4ROM em,lo;ees 2he-e em,lo;ee_i+ C1J'" 2%ERE em,lo;ee_i+ C1J'5 B. U)D#TE ne8_em,lo;ees SET name C SELECT last_name661i-st_name 4ROM em,lo;ees" 2%ERE em,lo;ee_i+ C1J'5 C. U)D#TE ne8_em,lo;ees SET name C SELECT last_name66 1i-st_name 4ROM em,lo;ees 2%ERE em,lo;ee_i+ C1J'" 2%ERE em,lo;ee_i+ C SELECT em,lo;ee_i+ 4ROM ne8 em,lo;ees"5 D. U)D#TE ne8_em,lo;ees SET name C SELECT last name66 1i-st_name 4ROM em,lo;ees 2%ERE em,lo;ee_i+C SELECT em,lo;ee_i+ 4ROM ne8_em,lo;ees"" 2%ERE em,lo;ee_i+ C1J'5 #ns8e-: # (. 2hich t8o statements about subMue-ies a-e t-ue3 Choose t8o." #. # sin:le -o8 subMue-; can -et-ie0e +ata 1-om onl; one table. B. # S>L Mue-; statement cannot +is,la; +ata 1-om table B that is -e1e--e+ to in its subMue-;/ unless table B is inclu+e+ in the main Mue-;7s 4ROM clause. C. # S>L Mue-; statement can +is,la; +ata 1-om table B that is -e1e--e+ to in its subMue-;/ 8ithout inclu+in: table B in its o8n 4ROM clause. D. # sin:le -o8 subMue-; can -et-ie0e +ata 1-om mo-e than one table. E. # sin:le -o8 subMue-; cannot be use+ in a con+ition 8he-e the LISE o,e-ato- is use+ 1o- com,a-ison. 4. # multi,leO-o8 subMue-; cannot be use+ in a con+ition 8he-e the LISE o,e-ato- is use+ 1o- com,a-ison. #ns8e-: B/ D D. EAamine the st-uctu-e o1 the STUDENTS table: STUDENT_ID STUDENT_N#ME COURSE_ID NUMBER $#RC%#R& 9'" $#RC%#R& 1'" NOT NULL/ )-ima-; Se; NOT NULL

Page 37 of 81
M#RSS ST#RT_D#TE 4INIS%_D#TE NUMBER D#TE D#TE

*ou nee+ to c-eate a -e,o-t o1 the 1' stu+ents 8ho achie0e+ the hi:hest -an<in: in the cou-se INT S>L an+ 8ho com,lete+ the cou-se in the ;ea- 1KKK. 2hich S>L statement accom,lishes this tas<3 #. SELECT stu+ent_ i+/ ma-<s/ RO2NUM .Ran<. 4ROM stu+ents 2%ERE RO2NUM RC 1' #ND 1inish_+ate BET2EEN 7'1OP#NOKK7 #ND 791ODECOKK7 #ND cou-se_i+ C 7INT_S>L7 ORDER B* ma-<s DESC5 B. SELECT stu+ent_i+/ ma-<s/ RO2ID .Ran<. 4ROM stu+ents 2%ERE RO2ID RC 1' #ND 1inish_+ate BET2EEN 7'1OP#NOKK7 #ND 791ODECOKK7 #ND cou-se_i+ C 7INT_S>L7 ORDER B* ma-<s5 C. SELECT stu+ent_i+/ ma-<s/ RO2NUM .Ran<. 4ROM SELECT stu+ent_i+/ ma-<s 4ROM stu+ents 2%ERE RO2NUM RC 1' #ND 1inish_+ate BET2EEN 7'1OP#NOKK7 #ND 791ODECOKK7 #ND cou-se_i+ C 7INT_S>L7 ORDER B* ma-<s DESC"5 D. SELECT stu+ent_i+/ ma-<s/ RO2NUM .Ran<I 4ROM SELECT stu+ent_i+/ ma-<s 4ROM stu+ents ORDER B* ma-<s DESC" 2%ERE RO2NUM RC 1' #ND 1inish_+ate BET2EEN 7'1OP#NOKK7 #ND 791ODECOKK7 #ND cou-se_i+ C 7INT_S>L75 #ns8e-: D E. EAamine the +ata 1-om the EM) table: EM)_ID 1 & 9 ! ( D E J DE)T_ID 1' &' 1' 1' 9' 9' 1' &' COMMISSION ('' 1''' D'' J'' &'' 9''

Page 38 of 81
The COMMISSION column sho8s the monthl; commission ea-ne+ b; the em,lo;ee. 2hich th-ee tas<s 8oul+ -eMui-e subMue-ies o- =oins in o-+e- to ,e-1o-m in a sin:le ste,3 Choose th-ee" #. Deletin: the -eco-+s o1 em,lo;ees 8ho +o not ea-n commission. B. Inc-easin: the commission o1 em,lo;ee 9 b; the a0e-a:e commission ea-ne+ in +e,a-tment &'. C. 4in+in: the numbe- o1 em,lo;ees 8ho +o NOT ea-n commission an+ a-e 8o-<in: 1o+e,a-tment &'. D. Inse-tin: into the table a ne8 em,lo;ee 1' 8ho 8o-<s 1o- +e,a-tment &' an+ ea-ns a commission that is eMual to the commission ea-ne+ b; em,lo;ee 9. E. C-eatin: a table calle+ COMMISSION that has the same st-uctu-e an+ +ata as the columns EM)_ID an+ COMMISSIONS o1 the EM) table. 4. Dec-easin: the commission b; 1(' 1o- the em,lo;ees 8ho a-e 8o-<in: in +e,a-tment 9' an+ ea-nin: a commission o1 mo-e then J''. #ns8e-: B/ D/ E J. EAamine the st-uctu-e o1 the EM)LO*EES table: EM)LO*EE_ID 4IRST_N#ME L#ST_N#ME DE)#RTMENT_ID S#L#R* NUMBER )-ima-; Se; $#RC%#R& &(" $#RC%#R& &(" NUMBER NUMBER

2hat is the co--ect s;ntaA 1o- an inline 0ie83 #. SELECT a.last_name/ a.sala-;/ a.+e,a-tment_i+/ b.maAsal 4ROM em,lo;ees a/ SELECT +e,a-tment_i+/ maA sala-;"maAsal 4ROM em,lo;ees NROU) B* +e,a-tment_i+" b 2%ERE a.+e,a-tment_i+ C b.+e,a-tment_i+ #ND a.sala-; R b.maAsal5 B. SELECT a.last name/ a.sala-;/ a.+e,a-tment_i+ 4ROM em,lo;ees a 2%ERE a.+e,a-tment_i+ IN SELECT +e,a-tment_i+ 4ROM em,lo;ees b NROU) B* +e,a-tment_i+ ha0in: sala-; C SELECT maA sala-;" 1-om em,lo;ees"" C. SELECT a.last_name/ a.sala-;/ a.+e,a-tment_i+ 4ROM em,lo;ees a 2%ERE a.sala-; C SELECT maA sala-;" 4ROM em,lo;ees b 2%ERE a.+e,a-tment_i+ C b.+e,a-tment_i+"5

Page 39 of 81
D. SELECT a.last_name/ a.sala-;/ a.+e,a-tment_i+ 4ROM em,lo;ees a 2%ERE a.+e,a-tment_i+/ a.sala-;" IN SELECT +e,a-tment_i+/ a.sala-;" IN SELECT +e,a-tment_i+ maA sala-;" 4ROM em,lo;ees b NROU) B* +e,a-tment_i+ ORDER B* +e,a-tment_i+"5 #ns8e-: # K. 2hich th-ee statements about subMue-ies a-e t-ue3 Choose th-ee" #. # sin:le -o8 subMue-; can -et-ie0e onl; one column an+ one -o8. B. # sin:le -o8 subMue-; can -et-ie0e onl; one -o8 but man; columns. C. # multi,le -o8 subMue-; can -et-ie0e multi,le -o8s an+ multi,le columns. D. # multi,le -o8 subMue-; can be com,a-e+ b; usin: the HQI o,e-ato-. E. # sin:le -o8 subMue-; can use the IN o,e-ato-. 4. # multi,le -o8 subMue-; can use the HCI o,e-ato-. #ns8e-: B/ C/ D 1'. 2hich o,e-ato- can be use+ 8ith a multi,leO-o8 subMue-;3 #. C B. LISE C. BET2EEN D. NOT IN E. IS 4. RQ #ns8e-: D 11. EAamine the +ata 1-om the ORDERS an+ CUSTOMERS tables. ORDERS ORD_ID 1'' 1'1 1'& 1'9 1'! 1'( 1'D 1'E 1'K CUSTOMERS CUST_ID 1' 1( &'

ORD_D#TE 1&OP#NO&''' 'KOM#RO&''' 'KOM#RO&''' 1(OM#RO&''' &(OPUNO&''' 1JOPULO&''' 1JOPULO&''' &1OPULO&''' '!O#UNO&''' CUST_N#ME Smith Bob Ma-tin

CUST_ID 1( !' 9( 1( 1( &' 9( &' 1'

ORD_TOT#L 1'''' J''' 1&('' 1&''' D''' (''' E''' D('' J''' CIT* Los #n:eles San 4-ancisco Chica:o

Page 40 of 81 &( 9' 9( !'


E0aluate the S>L statement: SELECT ? 4ROM o-+e-s 2%ERE cust_i+ C SELECT cust_i+ 4ROM custome-s 2%ERE cust_name C 7Smith7"5 2hat is the -esult 8hen the Mue-; is eAecute+3

Ma-; Rina Smith Lin+

Ne8 *o-< Chica:o Ne8 *o-< Ne8 *o-<

#. ORD_ID 1'& 1'D 1'J B. ORD_ID 1'& 1'D C. ORD_ID 1'J

ORD_D#TE 'KOM#RO&'' 1JOPULO&''' '!O#UNO&'''

CUST_ID 9( 9( 1'

ORD_TOT#L 1&('' E''' J'''

ORD_D#TE 'KOM#RO&'' 1JOPULO&''' ORD_D#TE '!O#UNO&'''

CUST_ID 9( 9( CUST_ID 1'

ORD_TOT#L 1&('' E''' ORD_TOT#L J'''

D. The Mue-; 1ails because the subMue-; -etu-ns mo-e than one -o8. E. The Mue-; 1ails because the oute- Mue-; an+ the inne- Mue-; a-e usin: +i11e-ent tables.
#ns8e-: D 1&. *ou +e1ine a multi,leO-o8 subMue-; in the 2%ERE clause o1 an S>L Mue-; 8ith a com,a-ison o,e-ato- .C.. 2hat ha,,ens 8hen the main Mue-; is eAecute+3 #. The main Mue-; eAecutes 8ith the 1i-st 0alue -etu-ne+ b; the subMue-;. B. The main Mue-; eAecutes 8ith the last 0alue -etu-ne+ b; the subMue-;. C. The main Mue-; eAecutes 8ith all the 0alues -etu-ne+ b; the subMue-;. D. The main Mue-; 1ails because the multi,leO-o8 subMue-; cannot be use+ 8ith the com,a-ison o,e-ato-. E. *ou cannot +e1ine a multi,leO-o8 subMue-; in the 2%ERE clause o1 a S>L Mue-;. #ns8e-: D 19. # subMue-; can be use+ to _________. #. C-eate :-ou,s o1 +ata B. So-t +ata in a s,eci1ic o-+e-

Page 41 of 81
C. Con0e-t +ata to a +i11e-ent 1o-mat D. Ret-ie0e +ata base+ on an un<no8n con+ition #ns8e-: D 1!. In 8hich scena-io 8oul+ TO) N anal;sis be the best solution3 #. *ou 8ant to i+enti1; the most senio- em,lo;ee in the com,an;. B. *ou 8ant to 1in+ the mana:e- su,e-0isin: the la-:est numbe- o1 em,lo;ees. C. *ou 8ant to i+enti1; the ,e-son 8ho ma<es the hi:hest sala-; 1o- all em,lo;ees. D. *ou 8ant to -an< the to, th-ee sales -e,-esentati0es 8ho ha0e sol+ the maAimum numbe- o1 ,-o+ucts. #ns8e-: D 1(. EM)LO*EES an+ DE)#RTMENTS +ata: EM)LO*EES EM)LO*EE_ID 1'1 1'& 1'9 1'! 1'( 1'D 1'J 11' 1&'

EM)_N#ME Smith Ma-tin Ch-is Pohn Diana Smith Penni1eBob Ra0i

DE)T_ID &' 1' &' 9' 9' !' 9' !' &'

MNR_ID 1&' 1'( 1&' 1'J 1'J 11' 11' 11'

POB_ID S#_RE) CLERS IT_#DMIN %R_CLERS IT_#DMIN #D_#SST %R_DIR EW_DIR S#_DIR

S#L#R* !''' &('' !&'' &('' (''' 9''' D('' J''' D(''

DE)#RTMENTS DE)#RTMENT_ID 1' &' 9' !'

DE)#RTMENT_N#ME #+min E+ucation IT %uman Resou-ces

On the EM)LO*EES table/ EM)LO*EE_ID is the ,-ima-; <e;. MNR_ID is the ID mana:e-s an+ -e1e-s to the EM)LO*EE_ID. On the DE)#RTMENTS table DE)#RTMENT_ID is the ,-ima-; <e;. E0aluate this U)D#TE statement. U)D#TE em,lo;ees SET m:-_i+ C SELECT m:-_i+ 4ROM em,lo;ees 2%ERE +e,t_i+C SELECT +e,a-tment_i+ 4ROM +e,a-tments 2%ERE +e,a-tment_name C 7#+minist-ation7""/ Sala-; C SELECT sala-; 4ROM em,lo;ees 2%ERE em,_name C 7Smith7" 2%ERE =ob_i+ C 7IT_#DMIN75

Page 42 of 81
2hat ha,,ens 8hen the statement is eAecute+3 #. The statement eAecutes success1ull;/ lea0es the mana:e- ID as the eAistin: 0alue/ an+ chan:es the sala-; to !''' 1o- the em,lo;ees 8ith ID 1'9 an+ 1'(. B. The statement eAecutes success1ull;/ chan:es the mana:e- ID to NULL/ an+ chan:es the sala-; to !''' 1o- the em,lo;ees 8ith ID 1'9 an+ 1'(. C. The statement eAecutes success1ull;/ chan:es the mana:e- ID to NULL/ an+ chan:es the sala-; to 9''' 1o- the em,lo;ees 8ith ID 1'9 an+ 1'(. D. The statement 1ails because the-e is mo-e than one -o8 matchin: the em,lo;ee name Smith. E. The statement 1ails because the-e is mo-e than one -o8 matchin: the IT_#DMIN =ob ID in the EM)LO*EES table. 4. The statement 1ails because the-e is no 7#+minist-ation7 +e,a-tment in the DE)#RTMENTS table. #ns8e-: D 1D. EAamine the st-uctu-e o1 the EM)LO*EES an+ NE2_EM)LO*EES tables: EM)LO*EES EM)LO*EE_ID 4IRST_N#ME L#ST_N#ME %IRE_D#TE NE2 EM)LO*EES EM)LO*EE_ID N#ME NUMBER )-ima-; Se; $#RC%#R& &(" $#RC%#R& &(" D#TE NUMBER $#RC%#R& D'" )-ima-; Se;

2hich DELETE statement is 0ali+3 #. DELETE 4ROM em,lo;ees 2%ERE em,lo;ee_i+ C SELECT em,lo;ee_i+ 4ROM em,lo;ees"5 B. DELETE ? 4ROM em,lo;ees 2%ERE em,lo;ee_i+ C SELECT em,lo;ee_i+ 4ROM ne8_em,lo;ees"5 C. DELETE 4ROM em,lo;ees 2%ERE em,lo;ee_i+ IN SELECT em,lo;ee_i+ 4ROM ne8_em,lo;ees 2%ERE name C 7Ca--e;7"5 D. DELETE ? 4ROM em,lo;ees 2%ERE em,lo;ee_i+ IN SELECT em,lo;ee_i+ 4ROM ne8_em,lo;ees 2%ERE last_name C 7Ca--e;7"5 #ns8e-: C 1E. In 8hich 1ou- clauses can a subMue-; be use+3 Choose 1ou-."

Page 43 of 81
#. in the INTO clause o1 an INSERT statement B. in the 4ROM clause o1 a SELECT statement C. in the NROU) B* clause o1 a SELECT statement D. in the 2%ERE clause o1 a SELECT statement E. in the SET clause o1 an U)D#TE statement 4. in the $#LUES clause o1 an INSERT statement #ns8e-: B/ D/ E/ 4 1J. EAamine the +ata in the EM)LO*EES table. L#ST_N#ME Net@ Da0is Sin: Da0is Y DE)#RTMENT_ID 1' &' &' 9' S#L#R* 9''' 1('' &&'' D'''

EAamine the subMue-;: SELECT last_name 4ROM em,lo;ees 2%ERE sala-; IN SELECT M#W sala-;" 4ROM em,lo;ees NROU) B* +e,a-tment_i+"5 2hich statement is t-ue3 #. The SELECT statement is s;ntacticall; accu-ate. B. The SELECT statement +oes not 8o-< because the-e is no %#$INN clause. C. The SELECT statement +oes not 8o-< because the column s,eci1ie+ in the NROU) B* clause is not in the SELECT list. D. The SELECT statement +oes not 8o-< because the NROU) B* clause shoul+ be in the main Mue-; an+ not in the subMue-;. #ns8e-: # 1K. 2hich t8o statements about subMue-ies a-e t-ue3 Choose t8o." #. # subMue-; shoul+ -et-ie0e onl; one -o8. B. # subMue-; can -et-ie0e @e-o o- mo-e -o8s. C. # subMue-; can be use+ onl; in S>L Mue-; statements. D. SubMue-ies C#NNOT be neste+ b; mo-e than t8o le0els. E. # subMue-; C#NNOT be use+ in an S>L Mue-; statement that uses :-ou, 1unctions. 4. 2hen a subMue-; is use+ 8ith an ineMualit; com,a-ison o,e-ato- in the oute- S>L statement/ the column list in the SELECT clause o1 the subMue-; shoul+ contain onl; one column. #ns8e-: B/ 4 &' ORDERS ORD_ID

ORD_D#TE

CUST_ID

ORD_TOT#L

Page 44 of 81
1'' 1'1 1'& 1'9 1'! 1'( 1'D 1'J CUSTOMERS CUST_ID 1' 1( &' &( 9' 9( !' 1&OP#BO&''' 'KOM#RO&''' 'KOM#RO&''' 1(OM#RO&''' &(OPUNO&''' 1JOPULO&''' 1JOPULO&''' '!O#UNO&''' CUST_N#ME Smith Bob Ma-tin Ma-; Rina Smith Lin+a 1( !' 9( 1( 1( &' 9( 1' CIT* Los #n:eles San 4-ancisco Chica:o Ne8 *o-< Chica:o Ne8 *o-< Ne8 *o-< J''' 1'''' J''' 1&('' 1&('' D''' (''' E'''

E0aluate this S>L statement: SELECT cust_i+/ o-+_total 4ROM o-+e-s 2%ERE o-+_total Q #N* SELECT o-+_total 4ROM o-+e-s 2%ERE cust_i+ IN SELECT cust_i+ 4ROM custome-s 2%ERE cit; LISE FNe8 *o-<G""5 2hat is the -esult 8hen the abo0e Mue-; is eAecute+3 #. CUST_ID ORD_TOT#L 1( 1'''' !' J''' 9( 1&('' 1( 1&('' 1' J''' B. CUST_ID 1( 9( 1( o< C. CUST_ID 1( !' 1( 1( &' 9( ORD_TOT#L 1'''' 1&('' 1&'''

ORD_TOT#L 1'''' J''' 1&''' D''' (''' E'''

Page 45 of 81
&' 1' D. CUST_ID 1( &' &' D('' J''' ORD_TOT#L D''' (''' D(''

E. The Mue-; -etu-ns no -o8s. 4. The Mue-; 1ails because #N* is not a 0ali+ o,e-ato- 8ith a subMue-;. #ns8e-: #

Page 46 of 81
Lesson E: Data Mani,ulation 1. *ou a++e+ a )%ONE_NUMBER column o1 NUMBER +ata t;,e to an eAistin: EM)LO*EES table. The EM)LO*EES table al-ea+; contains -eco-+s o1 1'' em,lo;ees. No8/ ;ou 8ant to ente- the ,hone numbe-s o1 each o1 the 1'' em,lo;ees into the table. Some o1 the em,lo;ees ma; not ha0e a ,hone numbe- a0ailable. 2hich +ata mani,ulation o,e-ation +o ;ou ,e-1o-m3 #. MERNE B. INSERT C. U)D#TE D. #DD E. ENTER 4. *ou cannot ente- the ,hone numbe-s 1o- the eAistin: em,lo;ee -eco-+s. #ns8e-: C &. 2hich a-e DML statements3 Choose all that a,,l;" #. COMMITY B. MERNEY C. U)D#TEY D. DELETEY E. CRE#TEY 4. DRO)Y #ns8e-: B/ C/ D 9. EAamine the st-uctu-e o1 the EM)LO*EES table: EM)LO*EE_ID 4IRST_N#ME L#ST_N#ME NUMBER )-ima-; Se; $#RC%#R& &(" $#RC%#R& &("

2hich th-ee statements inse-ts a -o8 into the table3 Choose th-ee" #. INSERT INTO em,lo;ees $#LUES NULL/ FPohnG/FSmithG"5 B. INSERT INTO em,lo;ees 1i-st_name/ last_name" $#LUES FPohnG/FSmithG"5 C. INSERT INTO em,lo;ees $#LUES F1'''G/FPohnG/NULL"5 D. INSERT INTO em,lo;ees 1i-st_name/last_name/ em,lo;ee_i+" $#LUES 1'''/ FPohnG/FSmithG"5 E. INSERT INTO em,lo;ees em,lo;ee_i+" $#LUES 1'''"5 4. INSERT INTO em,lo;ees em,lo;ee_i+/ 1i-st_name/ last_name" $#LUES 1'''/ FPohnG/FG"5 #ns8e-: C/ E/ 4 !. E0aluate the set o1 S>L statements: CRE#TE T#BLE +e,t +e,tno NUMBER &"/ +name $#RCN#R& 1!"/ loc $#RCN#R& 19""5 ROLLB#CS5

Page 47 of 81
DESCRIBE DE)T 2hat is t-ue about the set3 #. The DESCRIBE DE)T statement +is,la;s the st-uctu-e o1 the DE)T table. B. The ROLLB#CS statement 1-ees the sto-a:e s,ace occu,ies b; the DE)T table. C. The DESCRIBE DE)T statement -etu-ns an e--o- OR#O'!'!9: ob=ect DE)T +oes not eAist. D. The DESCRIBE DE)T statement +is,la;s the st-uctu-e o1 the DE)T table onl; i1 the-e is a COMMIT statement int-o+uce+ be1o-e the ROLLB#CS statement. #ns8e-: # (. EAamine the st-uctu-e i1 the EM)LO*EES an+ NE2 EM)LO*EES tables: EM)LO*EES EM)LO*EE_ID 4IRST_N#ME L#ST_N#ME %IRE_D#TE NE2 EM)LO*EES EM)LO*EE_ID N#ME NUMBER )-ima-; Se; $#RC%#R& &(" $#RC%#R& &(" D#TE NUMBER $#RC%#R& D'" )-ima-; Se;

2hich MERNE statement is 0ali+3 #. MERNE INTO ne8_em,lo;ees c USINN em,lo;ees e ON c.em,lo;ee_i+ C e.em,lo;ee_i+" 2%EN M#TC%ED T%EN U)D#TE SET c.name C e.1i-st_name 66G/G66 e.last_name 2%EN NOT M#TC%ED T%EN INSERT $#LUES e.em,lo;ee_i+/ e.1i-st_name 66G/ F66e.last_name"5 B. MERNE ne8_em,lo;ees c USINN em,lo;ees e ON c.em,lo;ee_i+ C e.em,lo;ee_i+" 2%EN EWIST T%EN U)D#TE SET c.name C e.1i-st_name 66G/G66 e.last_name 2%EN NOT M#TC%ED T%EN INSERT $#LUES e.em,lo;ee_i+/ e.1i-st_name 66G/ F66e.last_name"5 C. MERNE INTO ne8 em,lo;ees c USINN em,lo;ees e ON c.em,lo;ee_i+ C e.em,lo;ee_i+" 2%EN EWISTS T%EN U)D#TE SET c.name C e.1i-st_name 66G/G66 e.last_name 2%EN NOT M#TC%ED T%EN

Page 48 of 81
INSERT $#LUES e.em,lo;ee_i+/ e.1i-st_name 66G/ F66e.last_name"5 D. MERNE ne8_em,lo;ees c 4ROM em,lo;ees e ON c.em,lo;ee_i+ C e.em,lo;ee_i+" 2%EN M#TC%ED T%EN U)D#TE SET c.name C e.1i-st_name 66G/G66 e.last_name 2%EN NOT M#TC%ED T%EN INSERT INTO ne8_em,lo;ees $#LUES e.em,lo;ee_i+/ e.1i-st_name 66G.G66e.last_name"5 #ns8e-: # D. EAamine the +ata in the EM)LO*EES an+ EM)_%IST tables: EM)LO*EES EM)LO*EE_ID

1'1 1'& 1'9 1'! 1'( 1'D 1'J 11' 1&'


EM)_%IST EM)LO*EE_ID 1'1 1'9 1'! 1'D 1'J

POB_ID Smith Ma-tin Ch-is Pohn Diana B-;an Penni1eBob Ra0i


N#ME Smith Ch-is Pohn Smith Penni1e-

EM)_N#ME S#L#R* &' 1' &' 9' 9' !' 9' !' &'
POB_ID S#_CLERS IT_CLERS %R_CLERS #D_#SST %R_MNR

DE)T_ID 1&' 1'( 1&' 1'J 1'J 11' 11' 11'


S#L#R* &''' &&'' &''' 9''' !(''

MNR_ID !''' &('' !&'' &('' (''' 9''' D('' J''' D(''

S#_RE) CLERS IT_#DMIN %R_CLERS %R_MNR #D_#SST %R_DIR EW_DIR S#_DIR

The EM)_%IST table is u,+ate+ at the en+ o1 e0e-; ;ea-. The em,lo;ee ID/ name/ =ob ID/ an+ sala-; o1 each eAistin: em,lo;ee a-e mo+i1ie+ 8ith the latest +ata. Ne8 em,lo;ee +etails a-e a++e+ to the table. 2hich statement accom,lishes this tas<3 #. U)D#TE em,_hist SET em,lo;ee_i+/ name/ =ob_i+/ sala-; C SELECT em,lo;ee_i+/ name/ =ob_i+/ sala-; 4ROM em,lo;ees" 2%ERE em,lo;ee_i+ IN SELECT em,lo;ee_i+ 4ROM em,lo;ees"5 B. MERNE INTO em,_hist eh

Page 49 of 81
USINN em,lo;ees e ON eh.em,lo;ee_i+ C e.em,lo;ee_i+" 2%EN M#TC%ED T%EN U)D#TE SET eh.name C e.name/ eh.=ob_i+ C e.=ob_i+/ eh.sala-; C e.sala-; 2%EN NOT M#TC%ED T%EN INSERT $#LUES e.em,lo;ee i+/ e.name/ e.=ob i+/ e.sala-;"5 C. MERNE INTO em,_hist eh USINN em,lo;ees e ON eh.em,lo;ee_i+ C e.em,lo;ee_i+" 2%EN M#TC%ED T%EN U)D#TE em, hist SET eh.name C e.name/ eh.=ob_i+ C e.=ob_i+/ eh.sala-; C e.sala-; 2%EN NOT M#TC%ED T%EN INSERT INTO em,_hist $#LUES e.em,lo;ee_i+/ e.name/ e.=ob_i+/ e.sala-;"5 D. MERNE INTO em,_hist eh USINN em,lo;ees e 2%EN M#TC%ED T%EN U)D#TE em,_hist SET eh.name C e.name/ eh.=ob_i+ C e.=ob_i+/ eh.sala-; C e.sala-; 2%EN NOT M#TC%ED T%EN INSERT INTO em,_hist $#LUES e.em,lo;ee_i+/ e.name/ e.=ob_i+/ e.sala-;"5 #ns8e-: B E. EAamine the +ata in the EM)LO*EES table. EM)LO*EES EM)LO*EE_ID 1'1 1'& 1'9 1'! 1'( 1'D 1'J 11' 1&'

N#ME Smith Ma-tin Ch-is Pohn Diana B-;an Penni1eBob Ra0i

DE)T_ID &' 1' &' 9' 9' !' 9' !' &'

MNR_ID 1&' 1'( 1&' 1'J 1'J 11' 11' 11'

POB_ID S#_RE) CLERS IT_#DMIN %R_CLERS IT_#DMIN #D_#SST %R_DIR EW_DIR S#_DIR

S#L#R* !''' &('' !&'' &('' (''' 9''' D('' J''' D(''

On the EM)LO*EES table/ EM)LO*EE_ID is the ,-ima-; <e;. MNR_ID is the ID o1 mana:e-s an+ -e1e-s to the EM)LO*EE_ID. The POB_ID column is a NOT NULL column.

Page 50 of 81
E0aluate this DELETE statement: DELETE em,lo;ee_i+/ sala-;/ =ob_i+ 4ROM em,lo;ees 2%ERE +e,t_i+ C K'5 2h; +oes the DELETE statement 1ail 8hen ;ou eAecute it3 #. The-e is no -o8 8ith +e,t_i+ K' in the EM)LO*EES table. B. *ou cannot +elete the POB_ID column because it is a NOT NULL column. C. *ou cannot s,eci1; column names in the DELETE clause o1 the DELETE statement. D. *ou cannot +elete the EM)LO*EE_ID column because it is the ,-ima-; <e; o1 the table. #ns8e-: C J. EAamine the st-uctu-e o1 the EM)LO*EES table: EM)LO*EE_ID 4IRST_N#ME L#ST_N#ME %IRE_D#TE *ou issue these statements: CRE#TE table ne8_em, em,lo;ee_i+ NUMBER/ name $#RC%#R& 9'""5 INSERT INTO ne8_em, SELECT em,lo;ee_i+ / last_name 1-om em,lo;ees5 Sa0e,oint s15 U)D#TE ne8_em, set name C U))ER name"5 Sa0e,oint s&5 Delete 1-om ne8_em,5 Rollbac< to s&5 Delete 1-om ne8_em, 8he-e em,lo;ee_i+ C1J'5 U)D#TE ne8_em, set name C 7Pames75 Rollbac< to s&5 U)D#TE ne8_em, set name C 7Pames7 2%ERE em,lo;ee_i+ C1J'5 Rollbac<5 #t the en+ o1 this t-ansaction/ 8hat is t-ue3 #. *ou ha0e no -o8s in the table. B. *ou ha0e an em,lo;ee 8ith the name o1 Pames. C. *ou cannot -oll bac< to the same sa0e,oint mo-e than once. D. *ou- last u,+ate 1ails to u,+ate an; -o8s because em,lo;ee ID 1J' 8as al-ea+; +elete+. #ns8e-: # K. EAamine the st-uctu-e o1 the EM)LO*EES table: EM)LO*EE_ID EM)_N#ME POB_ID S#L NUMBER $#RC%#R& 9'" $#RC%#R& &'" NUMBER NOT NULL DE4#ULT 7S#_RE)7 NUMBER )-ima-; Se; $#RC%#R& &(" $#RC%#R& &(" D#TE

Page 51 of 81
COMM_)CT NUMBER MNR_ID NUMBER DE)#RTMENT_ID NUMBER *ou nee+ to u,+ate the -eco-+s o1 em,lo;ees 1'9 an+ 11(. The U)D#TE statement ;ou s,eci1; shoul+ u,+ate the -o8s 8ith the 0alues s,eci1ie+ belo8: POB_ID: De1ault 0alue s,eci1ie+ 1o- this column +e1inition. S#L: MaAimum sala-; ea-ne+ 1o- the =ob ID S#_RE). COMM_)CT: De1ault 0alue s,eci1ie+ 1o- this commission ,e-centa:e column/ i1 an;. I1 no +e1ault 0alue is s,eci1ie+ 1o- the column/ the 0alue shoul+ be NULL. DE)#RTMENT_ID: Su,,lie+ b; the use- +u-in: -un time th-ou:h substitution 0a-iable. 2hich U)D#TE statement meets the -eMui-ements3 #. U)D#TE em,lo;ees SET =ob_i+ C DE4#ULT #ND Sal C SELECT M#W sal" 4ROM em,lo;ees 2%ERE =ob_i+ C 7S#_RE)7" #ND comm_,ct C DE4#ULT #ND +e,a-tment_i+ C Z+i+ 2%ERE em,lo;ee_i+ IN 1'9/11("5 B. U)D#TE em,lo;ees SET =ob_i+ C DE4#ULT #ND Sal C M#W sal" #ND comm_,ct C DE4#ULT OR NULL #ND +e,a-tment_i+ C Z+i+ 2%ERE em,lo;ee_i+ IN 1'9/11(" #ND =ob_i+ C 7S#_RE)75 C. U)D#TE em,lo;ees SET =ob_i+ C DE4#ULT/ Sal C SELECT M#W sal" 4ROM em,lo;ees 2%ERE =ob_i+ C 7S#_RE)7"/ comm_,ct C DE4#ULT/ +e,a-tment_i+ C Z+i+ 2%ERE em,lo;ee_i+ IN 1'9/11("5 D. U)D#TE em,lo;ees SET =ob_i+ C DE4#ULT/ Sal C M#W sal"/ comm_,ct C DE4#ULT/ +e,a-tment_i+ C Z+i+ 2%ERE em,lo;ee_i+ IN 1'9/11(" #ND =ob_i+ C 7S#_RE)75 E. U)D#TE em,lo;ees SET =ob_i+ C DE4#ULT/ Sal C SELECT M#W sal" 4ROM em,lo;ees 2%ERE =ob_i+ C 7S#_RE)7" comm_,ct C DE4#ULT OR NULL/

Page 52 of 81
+e,a-tment_i+ C Z+i+ 2%ERE em,lo;ee_i+ IN 1'9/11("5 #ns8e-: C 1'. 2hich t8o statements com,lete a t-ansaction3 Choose t8o" #. DELETE em,lo;ees5 B. DESCRIBE em,lo;ees5 C. ROLLB#CS TO S#$E)OINT C5 D. NR#NT SELECT ON em,lo;ees TO SCOTT5 E. #LTER T#BLE em,lo;ees SET UNUSED COLUMN sal5 4. Select M#W sal" 4ROM em,lo;ees 2%ERE +e,a-tment_i+ C &'5 #ns8e-: D/E 11. # +ata mani,ulation lan:ua:e statement _____. #. com,letes a t-ansaction on a table B. mo+i1ies the st-uctu-e an+ +ata in a table C. mo+i1ies the +ata but not the st-uctu-e o1 a table D. mo+i1ies the st-uctu-e but not the +ata o1 a table #ns8e-: C 1&. *ou o8n a table calle+ EM)LO*EES 8ith this table st-uctu-e: EM)LO*EE_ID 4IRST_N#ME L#ST_N#ME %IRE_D#TE NUMBER )-ima-; Se; $#RC%#R& &(" $#RC%#R& &(" D#TE

2hat ha,,ens 8hen ;ou eAecute this DELETE statement3 DELETE em,lo;ees5 #. *ou :et an e--o- because o1 a ,-ima-; <e; 0iolation. B. The +ata an+ st-uctu-e o1 the EM)LO*EES table a-e +elete+. C. The +ata in the EM)LO*EES table is +elete+ but not the st-uctu-e. D. *ou :et an e--o- because the statement is not s;ntacticall; co--ect. #ns8e- : C 19. EAamine the st-uctu-e o1 the EM)LO*EES an+ NE2_EM)LO*EES tables: EM)LO*EES EM)LO*EE_ID 4IRST_N#ME L#ST_N#ME %IRE_D#TE NUMBER )-ima-; Se; $#RC%#R& &(" $#RC%#R& &(" D#TE

Page 53 of 81
NE2_EM)LO*EES EM)LO*EE_ID N#ME NUMBER $#RC%#R& D'" )-ima-; Se;

2hich MERNE statement is 0ali+3 #. MERNE INTO ne8_em,lo;ees c USINN em,lo;ees e ON c.em,lo;ee_i+ C e.em,lo;ee_i+" 2%EN M#TC%ED T%EN U)D#TE SET c.name C e.1i-st_name 667/766 e.last_name 2%EN NOT M#TC%ED T%EN INSERT $#LUES e.em,lo;ee_i+/ e.1i-st_name 667/ 766e.last_name"5 B. MERNE ne8_em,lo;ees c USINN em,lo;ees e ON c.em,lo;ee_i+ C e.em,lo;ee_i+" 2%EN EWISTS T%EN U)D#TE SET c.name C e.1i-st_name 667/766 e.last_name 2%EN NOT M#TC%ED T%EN INSERT $#LUES e.em,lo;ee_i+/ e.1i-st_name 667/ 766e.last_name"5 C. MERNE INTO ne8_em,lo;ees c USINN em,lo;ees e ON c.em,lo;ee_i+ C e.em,lo;ee_i+" 2%EN EWISTS T%EN U)D#TE SET c.name C e.1i-st_name 667/766 e.last_name 2%EN NOT M#TC%ED T%EN INSERT $#LUES e.em,lo;ee_i+/ e.1i-st_name 667/ 766e.last_name"5 D. MERNE ne8_em,lo;ees c 4ROM em,lo;ees e ON c.em,lo;ee_i+ C e.em,lo;ee_i+" 2%EN M#TC%ED T%EN U)D#TE SET c.name C e.1i-st_name 667/766 e.last_name 2%EN NOT M#TC%ED T%EN INSERT INTO ne8_em,lo;ees $#LUES e.em,lo;ee_i+/ e.1i-st_name 667/ 766e.last_name"5 #ns8e-: # 1!. 2hich th-ee a-e t-ue3 Choose th-ee." #. # MERNE statement is use+ to me-:e the +ata o1 one table 8ith +ata 1-om anothe-. B. # MERNE statement -e,laces the +ata o1 one table 8ith that o1 anothe-. C. # MERNE statement can be use+ to inse-t ne8 -o8s into a table. D. # MERNE statement can be use+ to u,+ate eAistin: -o8s in a table. #ns8e-: #/ C/ D

Page 54 of 81
1(. EAamine the st-uctu-e o1 the EM)LO*EES table: EM)LO*EE_ID 4IRST_N#ME L#ST_N#ME %IRE_D#TE NUMBER )-ima-; Se; $#RC%#R& &(" $#RC%#R& &(" D#TE

2hich INSERT statement is 0ali+3 #. INSERT INTO em,lo;ees em,lo;ee_i+/ 1i-st_name/ last_name/ hi-e_+ate" $#LUES 1'''/ FPohnG/ FSmithG/ F'1V'1V'1G"5 B. INSERT INTO em,lo;ees em,lo;ee_i+/ 1i-st_name/ last_name/ hi-e_+ate" $#LUES 1'''/ FPohnG/ FSmithG/ G'1 Panua-; '1G"5 C. INSERT INTO em,lo;ees em,lo;ee_i+/ 1i-st_name/ last_name/ %i-e_+ate" $#LUES 1'''/ FPohnG/ FSmithG/ To_+ate F'1V'1V'1G""5 D. INSERT INTO em,lo;ees em,lo;ee_i+/ 1i-st_name/ last_name/ hi-e_+ate" $#LUES 1'''/ FPohnG/ FSmithG/ '1OPanO'1"5 #ns8e-: B 1D. EAamine the st-uctu-e o1 the EM)LO*EES table: EM)LO*EE_ID 4IRST_N#ME L#ST_N#ME %IRE_D#TE NUMBER )-ima-; Se; $#RC%#R& &(" $#RC%#R& &(" D#TE

2hich U)D#TE statement is 0ali+3 #. U)D#TE em,lo;ees SET 1i-st_name C FPohnG SET last_name C FSmithG 2%ERE em,lo;ee_i+ C 1J'5 B. U)D#TE em,lo;ees SET 1i-st_name C FPohnG/ SET last_name C FSmothG 2%ERE em,lo;ee_i+ C 1J'5 C. U)D#TE em,lo;ee SET 1i-st_name C FPohnG #ND last_name C FSmithG 2%ERE em,lo;ee_i+ C 1J'5 D. U)D#TE em,lo;ee SET 1i-st_name C FPohnG/ last_name C FSmithG 2%ERE em,lo;ee_i+ C 1J'5 #ns8e-: D

Page 55 of 81
Lesson J: 2o-<in: 8ith Tables. 1. 2hich +esc-ibes the +e1ault beha0io- 8hen ;ou c-eate a table3 #. The table is accessible to all use-s. B. Tables a-e c-eate+ in the ,ublic schema. C. Tables a-e c-eate+ in ;ou- schema. D. Tables a-e c-eate+ in the DB# schema. E. *ou must s,eci1; the schema 8hen the table is c-eate+. #ns8e-: C &. *ou nee+ to c-eate a table name+ ORDERS that contains 1ou- columns: 1. an ORDER_ID column o1 numbe- +ata t;,e &.O a CUSTOMER_ID column o1 numbe- +ata t;,e 9. an ORDER_ST#TUS column that contains a cha-acte- +ata t;,e !. a D#TE_ORDERED column to contain the +ate the o-+e- 8as ,lace+ 2hen a -o8 is inse-te+ into the table/ i1 no 0alue is ,-o0i+e+ 1o- the status o1 the o-+e-/ the 0alue )ENDINN shoul+ be use+ instea+. 2hich statement accom,lishes this3 #. CRE#TE T#BLE o-+e-s o-+e-_i+ NUMBER 1'"/ custome-_i+ NUMBER J"/ o-+e-_status $#RC%#R& 1'"/ +ate_o-+e-e+ D#TE C S*SD#TE"5 B. CRE#TE T#BLE o-+e-s o-+e-_i+ NUMBER 1'"/ custome-_i+ NUMBER J"/ o-+e-_status $#RC%#R& 1'"/ +ate_o-+e-e+ D#TE DE4#ULT S*SD#TE" C. CRE#TE OR RE)L#CE T#BLE o-+e-s o-+e-_i+ NUMBER 1'"/ custome-_i+ NUMBER J"/ o-+e-_status $#RC%#R& 1'"/ +ate_o-+e-e+ D#TE C S*SD#TE"5

Page 56 of 81
D. CRE#TE T#BLE o-+e-s o-+e-_i+ NUMBER 1'"/ custome-_i+ NUMBER J" o-+e-_status NUMBER 1'"/ +ate_o-+e-e+ D#TE DE4#ULT S*SD#TE"5 #ns8e-: B 9. 2hich is a 0ali+ CRE#TE T#BLE statement3 #. CRE#TE T#BLE EM)KLX em,i+ numbe- &""5 B. CRE#TE T#BLE EM)?1&9 em,i+ numbe- &""5 C. CRE#TE T#BLE )#CS#NE ,ac<i+ numbe- &""5 D. CRE#TE T#BLE 1EM)_TEST em,i+ numbe- &""5 #ns8e-: # !. 2hich th-ee a-e D#TETIME +ata t;,es that can be use+ 8hen s,eci1;in: column +e1initions3 Choose th-ee." #. TIMEST#M) B. INTER$#L MONT% TO D#* C. INTER$#L D#* TO SECOND D. INTER$#L *E#R TO MONT% E. TIMEST#M) 2IT% D#T#B#SE TIME[ONE #ns8e-: #/ C/ D (. 2hich 1ou- a-e co--ect :ui+elines 1o- namin: +atabase tables3 Choose 1ou-" #. Must be:in 8ith eithe- a numbe- o- a lette-. B. Must be 1O9' cha-acte-s lon:. C. Shoul+ not be an O-acle Se-0e- -ese-0e+ 8o-+. D. Must contain onl; #O[/ aO@/ 'OB/ _/ ?/ an+ X. E. Must contain onl; #O[/ aO@/ 'OK/ _/ L/ an+ X. 4. Must be:in 8ith a lette-. #ns8e-: B/ C/ E/ 4 D. 2hat +oes the TRUNC#TE statement +o3 #. Remo0es the table B. Remo0es all -o8s 1-om a table C. Sho-tens the table to 1' -o8s D. Remo0es all columns 1-om a table E. Remo0es 1o-ei:n <e;s 1-om a table #ns8e-: B

Page 57 of 81 E. *ou nee+ to chan:e the +e1inition o1 an eAistin: table. The COMMERCI#LS table nee+s its DESCRI)TION column chan:e+ to hol+ 0a-;in: len:th cha-acte-s u, to &''' b;tes. The column can cu--entl; hol+ 1''' b;tes ,e- 0alue. The table contains &'''' -o8s. 2hich statement is 0ali+3
#. #LTER T#BLE comme-cials MODI4* +esc-i,tion C%#R& &'''""5 B. #LTER T#BLE comme-cials C%#NNE +esc-i,tion C%#R& &'''""5 C. #LTER T#BLE comme-cials C%#NNE +esc-i,tion $#RC%#R& &'''""5 D. #LTER T#BLE comme-cials MODI4* +esc-i,tion $#RC%#R& &'''""5 E. *ou cannot inc-ease the si@e o1 a column i1 the table has -o8s. #ns8e-: D

J. The EM)LO*EES table has these columns: L#ST N#ME S#L#R* %IRE_D#TE $#RC%#R& 9(" NUMBER J/&" D#TE

Mana:ement 8ants to a++ a +e1ault 0alue to the S#L#R* column. *ou ,lan to alte- the table b; usin: this S>L statement: #LTER T#BLE EM)LO*EES MODI4* S#L#R* DE4#ULT ('''"5 2hat is t-ue about ;ou- #LTER statement3 #. Column +e1initions cannot be alte-e+ to a++ DE4#ULT 0alues. B. # chan:e to the DE4#ULT 0alue a11ects onl; subseMuent inse-tions to the table. C. Column +e1initions cannot be alte-e+ at a++ DE4#ULT 0alues 1o- columns 8ith a NUMBER +ata t;,e. D. #ll the -o8s that ha0e a NULL 0alue 1o- the S#L#R* column 8ill be u,+ate+ 8ith the 0alue ('''. #ns8e-: B K. 2hich statement +esc-ibes the RO2ID +ata t;,e3 #. Bina-; +ata u, to ! :i:ab;tes. B. Cha-acte- +ata u, to ! :i:ab;tes. C. Ra8 bina-; +ata o1 0a-iable len:th u, to & :i:ab;tes. D. Bina-; +ata sto-e+ in an eAte-nal 1ile/ u, to ! :i:ab;tes. E. # heAa+ecimal st-in: -e,-esentin: the uniMue a++-ess o1 a -o8 in its table. #ns8e-: E 1'. E0aluate the S>L statement DRO) T#BLE DE)T:

Page 58 of 81
2hich 1ou- statements a-e t-ue o1 the S>L statement3 Choose 1ou-" #. *ou cannot -oll bac< this statement. B. #ll ,en+in: t-ansactions a-e committe+. C. #ll 0ie8s base+ on the DE)T table a-e +elete+. D. #ll in+eAes base+ on the DE)T table a-e +-o,,e+. E. #ll +ata in the table is +elete+/ an+ the table st-uctu-e is also +elete+. 4. #ll +ata in the table is +elete+/ but the st-uctu-e o1 the table is -etaine+. N. #ll s;non;ms base+ on the DE)T table a-e +elete+. #ns8e-: #/ B/ D/ E 11. E0aluate the S>L statement: TRUNC#TE T#BLE DE)T5 2hich th-ee a-e t-ue about the S>L statement3 Choose th-ee." #. It -eleases the sto-a:e s,ace use+ b; the table. B. It +oes not -elease the sto-a:e s,ace use+ b; the table. C. *ou can -oll bac< the +eletion o1 -o8s a1te- the statement eAecutes. D. *ou can NOT -oll bac< the +eletion o1 -o8s a1te- the statement eAecutes. E. #n attem,t to use DESCRIBE on the DE)T table a1te- the TRUNC#TE statement eAecutes 8ill +is,la; an e--o-. 4. *ou must be the o8ne- o1 the table o- ha0e DELETE #N* T#BLE s;stem ,-i0ile:es to t-uncate the DE)T table #ns8e-: #/ D/ 4

Page 59 of 81
Lesson K: Const-aints 1. 2hich 1ou- a-e 0ali+ O-acle const-aint t;,es3 Choose 1ou-." #. C#SC#DE B. UNI>UE C. NONUNI>UE D. C%ECS E. )RIM#R* SE* 4. CONST#NT N. NOT NULL #ns8e-: B/ D/ E/ N &. 2hich statement a++s a const-aint that ensu-es the CUSTOMER_N#ME column o1 the CUSTOMERS table hol+s a 0alue3 #. #LTER T#BLE custome-s #DD CONSTR#INT cust_name_nn C%ECS custome-_name IS NOT NULL5 B. #LTER T#BLE custome-s MODI4* CONSTR#INT cust_name_nn C%ECS custome-_name IS NOT NULL5 C. #LTER T#BLE custome-s MODI4* custome-_name CONSTR#INT cust_name_nn NOT NULL5 D. #LTER T#BLE custome-s MODI4* custome-_name CONSTR#INT cust_name_nn IS NOT NULL5 E. #LTER T#BLE custome-s MODI4* name CONSTR#INT cust_name_nn NOT NULL5 4. #LTER T#BLE custome-s #DD CONSTR#INT cust_name_nn C%ECS custome-_name NOT NULL5 #ns8e-: C 9. *ou nee+ to mo+i1; the STUDENTS table to a++ a ,-ima-; <e; on the STUDENT_ID column. The table is cu--entl; em,t;. 2hich statement accom,lishes this tas<3 #. #LTER T#BLE stu+ents #DD )RIM#R* SE* stu+ent_i+5 B. #LTER T#BLE stu+ents #DD CONSTR#INT )RIM#R* SE* stu+ent_i+"5 C. #LTER T#BLE stu+ents #DD CONSTR#INT stu+_i+_,< )RIM#R* SE* stu+ent_i+5 D. #LTER T#BLE stu+ents #DD CONSTR#INT stu+_i+_,< )RIM#R* SE* stu+ent_i+"5 E. #LTER T#BLE stu+entsMODI4* CONSTR#INT stu+_i+_,< )RIM#R* SE* stu+ent_i+"5 #ns8e-: D !. EAamine the st-uctu-e o1 the EM)LO*EES table: EM)LO*EE_ID 4IRST_N#ME L#ST_N#ME NUMBER )-ima-; Se; $#RC%#R& &(" $#RC%#R& &("

2hich th-ee statements inse-t a -o8 into the table3 Choose th-ee."

Page 60 of 81
#. INSERT INTO em,lo;ees $#LUES NULL/ 7Pohn7/ 7Smith7"5 B. INSERT INTO em,lo;ees 1i-st_name/ last_name" $#LUES 7Pohn7/ 7Smith7"5 C. INSERT INTO em,lo;ees $#LUES 71'''7/ 7Pohn7/ NULL"5 D. INSERT INTO em,lo;ees 1i-st_name/ last_name/ em,lo;ee_i+" $#LUES 1'''/ 7Pohn7/ 7Smith7"5 E. INSERT INTO em,lo;ees em,lo;ee_i+" $#LUES 1'''"5 4. INSERT INTO em,lo;ees em,lo;ee_i+/ 1i-st_name/ last_name" $#LUES 1'''/ 7Pohn7/ 77"5 #ns8e-: C/ E/ 4 (. EAamine the S>L statement that c-eates ORDERS table: CRE#TE T#BLE o-+e-s SER_NO NUMBER UNI>UE/ ORDER_ID NUMBER/ ORDER_D#TE D#TE NOT NULL/ ST#TUS $#RC%#R& 1'" C%ECS status IN 7CREDIT7/ 7C#S%7""/ )ROD_ID NUMBER RE4ERENCES )RODUCTS )RODUCT_ID"/ ORD_TOT#L NUMBER/ )RIM#R* SE* o-+e-_i+/ o-+e-_+ate""5 4o- 8hich columns 8oul+ an in+eA be automaticall; c-eate+ 8hen ;ou eAecute the abo0e S>L statement3 Choose t8o."

#. SER_NO B. ORDER_ID C. ST#TUS D. )ROD_ID E. ORD_TOT#L 4. com,osite in+eA on ORDER_ID an+ ORDER_D#TE #ns8e-: #/ 4 D. 2hich const-aint can be +e1ine+ onl; at the column le0el3 #. UNI>UE B. NOT NULL C. C%ECS D. )RIM#R* SE* E. 4OREINN SE* #ns8e-: B E. 2hich 0ie8 shoul+ a use- Mue-; to +is,la; the columns associate+ 8ith the const-aints on a table o8ne+ b; the use-3 #. USER_CONSTR#INTS B. USER_OBPECTS C. #LL_CONSTR#INTS D. USER_CONS_COLUMNS E. USER_COLUMNS #ns8e- : D

Page 61 of 81
J. *ou nee+ to +esi:n a stu+ent -e:ist-ation +atabase that contains se0e-al tables sto-in: aca+emic in1o-mation. The STUDENTS table sto-es in1o-mation about a stu+ent. The STUDENT_NR#DES table sto-es in1o-mation about the stu+ent7s :-a+es. Both o1 the tables ha0e a column name+ STUDENT_ID. The STUDENT_ID column in the STUDENTS table is a ,-ima-; <e;. *ou nee+ to c-eate a 1o-ei:n <e; on the STUDENT_ID column o1 the STUDENT_NR#DES table that ,oints to the STUDENT_ID column o1 the STUDENTS table. 2hich statement c-eates the 1o-ei:n <e;3 #. CRE#TE T#BLE stu+ent_:-a+es stu+ent_i+ NUMBER 1&"/semeste-_en+ D#TE/ :,a NUMBER !/9"/ CONSTR#INT stu+ent_i+_1< RE4ERENCES stu+ent_i+" 4OREINN SE* stu+ents stu+ent_i+""5 B. CRE#TE T#BLE stu+ent_:-a+es stu+ent_i+ NUMBER 1&"/semeste-_en+ D#TE/ :,a NUMBER !/9"/ stu+ent_i+_1< 4OREINN SE* stu+ent_i+" RE4ERENCES stu+ents stu+ent_i+""5 C. CRE#TE T#BLE stu+ent_:-a+es stu+ent_i+ NUMBER 1&"/semeste-_en+ D#TE/ :,a NUMBER !/9"/ CONSTR#INT 4OREINN SE* stu+ent_i+" RE4ERENCES stu+ents stu+ent_i+""5 D. CRE#TE T#BLE stu+ent_:-a+es stu+ent_i+ NUMBER 1&"/semeste-_en+ D#TE/ :,a NUMBER !/9"/ CONSTR#INT stu+ent_i+_1< 4OREINN SE* stu+ent_i+" RE4ERENCES stu+ents stu+ent_i+""5 #ns8e-: D K. 2hich t8o statements a-e t-ue about const-aints3 Choose t8o." #. The UNI>UE const-aint +oes not ,e-mit a null 0alue 1o- the column. B. # UNI>UE in+eA :ets c-eate+ 1o- columns 8ith )RIM#R* SE* an+ UNI>UE const-aints. C. The )RIM#R* SE* an+ 4OREINN SE* const-aints c-eate a UNI>UE in+eA. D. The NOT NULL const-aint ensu-es that null 0alues a-e not ,e-mitte+ 1o- the column. #ns8e-: B/ D 1'. 4o- 8hich t8o const-aints +oes the O-acle Se-0e- im,licitl; c-eate a uniMue in+eA3 Choose t8o." #. NOT NULL B. )RIM#R* SE* C. 4OREINN SE* D. C%ECS E. UNI>UE #ns8e-: B/ E 11. 2hich s;ntaA tu-ns an eAistin: const-aint on3 #. #LTER T#BLE table_name EN#BLE const-aint_name5

Page 62 of 81
B. #LTER T#BLE table_name ST#TUS C EN#BLE CONSTR#INT const-aint_name5 C. #LTER T#BLE table_name EN#BLE CONSTR#INT const-aint_name5 D. #LTER T#BLE table_name ST#TUS EN#BLE CONSTR#INT const-aint_name5 E. #LTER T#BLE table_name TURN ON CONSTR#INT const-aint_name5 4. #LTER T#BLE table_name TURN ON CONSTR#INT const-aint_name5 #ns8e-: C 1&. *ou nee+ to mo+i1; the STUDENTS table to a++ a ,-ima-; <e; on the STUDENT_ID column. The table is cu--entl; em,t;. 2hich statement accom,lishes this tas<3 #. #LTER T#BLE stu+ents #DD )RIM#R* SE* stu+ent_i+5 B. #LTER T#BLE stu+ents #DD CONSTR#INT )RIM#R* SE* stu+ent_i+"5 C. #LTER T#BLE stu+ents #DD CONSTR#INT stu+_i+_,< )RIM#R* SE* stu+ent_i+5 D. #LTER T#BLE stu+ents #DD CONSTR#INT stu+_i+_,< )RIM#R* SE* stu+ent_i+"5 E. #LTER T#BLE stu+ents MODI4* CONSTR#INT stu+_i+_,< )RIM#R* SE* stu+ent_i+"5 #ns8e-: D 19. EAamine the +ata in the EM)LO*EES an+ DE)#RTMENTS tables: EM)LO*EES EM)LO*EE_ID 1'1 1'& 1'9 1'! 1'( 1'D 1'J 11' 1&' DE)#RTMENTS DE)#RTMENT_ID 1' &' 9' !' EM)_N#ME Smith Ma-tin Ch-is Pohn Diana Smith Penni1eBob Ra0i DE)T_ID &' 1' &' 9' 9' !' 9' !' &' MNR_ID 1&' 1'( 1&' 1'J 1'J 11' 11' 11' POB_ID S#_RE) CLERS IT_#DMIN %R_CLERS IT_#DMIN #D_#SST %R_DIR EW_DIR S#_DIR S#L#R* !''' &('' !&'' &('' (''' 9''' D('' J''' D(''

DE)#RTMENT_N#ME #+min E+ucation IT %uman Resou-ces

#lso eAamine the S>L statements that c-eate the EM)LO*EES an+ DE)#RTMENTS tables: CRE#TE T#BLE +e,a-tments +e,a-tment_i+ NUMBER )RIM#R* SE*/ +e,a-tment_name $#RC%#R& 9'""5 CRE#TE T#BLE em,lo;ees EM)LO*EE_ID NUMBER )RIM#R* SE*/ EM)_N#ME $#RC%#R& &'"/ DE)T_ID NUMBER RE4ERENCES +e,a-tments +e,a-tment_i+"/ MNR_ID NUMBER RE4ERENCES em,lo;ees em,lo;ee i+"/ MNR_ID NUMBER RE4ERENCES em,lo;ees em,lo;ee i+"/ POB_ID $#RC%#R& 1(". S#L#R* NUMBER"5 On the EM)LO*EES table/ EM)LO*EE_ID is the ,-ima-; <e;.

Page 63 of 81
MNR_ID is the ID o1 mana:e-s an+ -e1e-s to the EM)LO*EE_ID. DE)T_ID is 1o-ei:n <e; to DE)#RTMENT_ID column o1 the DE)#RTMENTS table. On the DE)#RTMENTS table/ DE)#RTMENT_ID is the ,-ima-; <e;. EAamine this DELETE statement: DELETE 4ROM +e,a-tments 2%ERE +e,a-tment i+ C !'5 2hat ha,,ens 8hen ;ou eAecute the DELETE statement3 #. Onl; the -o8 8ith +e,a-tment ID !' is +elete+ in the DE)#RTMENTS table. B. The statement 1ails because the-e a-e chil+ -eco-+s in the EM)LO*EES table 8ith +e,a-tment ID !'. C. The -o8 8ith +e,a-tment ID !' is +elete+ in the DE)#RTMENTS table. #lso the -o8s 8ith em,lo;ee IDs 11' an+ 1'D a-e +elete+ 1-om the EM)LO*EES table. D. The -o8 8ith +e,a-tment ID !' is +elete+ in the DE)#RTMENTS table. #lso the -o8s 8ith em,lo;ee IDs 1'D an+ 11' an+ the em,lo;ees 8o-<in: un+e- em,lo;ee 11' a-e +elete+ 1-om the EM)LO*EES table. E. The -o8 8ith +e,a-tment ID !' is +elete+ in the DE)#RTMENTS table. #lso all the -o8s in the EM)LO*EES table a-e +elete+. 4. The statement 1ails because the-e a-e no columns s,eci1ies in the DELETE clause o1 the DELETE statement. #ns8e-: B 1!. 2hich S>L statement +e1ines the 4OREINN SE* const-aint on the DE)TNO column o1 the EM) table3 #. CRE#TE T#BLE EM) em,no NUMBER !"/ ename $#RCN#R& 9("/ +e,tno NUMBER E/&" NOT NULL CONSTR#INT em,_+e,tno_1< 4OREINN SE* +e,tno RE4ERENCES +e,t +e,tno"5 B. CRE#TE T#BLE EM) em,no NUMBER !"/ ename $#RCN#R& 9("/ +e,tno NUMBER E/&" CONSTR#INT em,_+e,tno_1< RE4ERENCES +e,t +e,tno""5 C. CRE#TE T#BLE EM) em,no NUMBER !" ename $#RC%#R& 9("/ +e,tno NUMBER E/&" NOT NULL/ CONSTR#INT em,_+e,tno_1< RE4ERENCES +e,t +e,tno" 4OREINN SE* +e,tno""5 D. CRE#TE T#BLE EM) em,no NUMBER !"/ ename $#RCN#R& 9("/ +e,tno NUMBER E/&" 4OREINN SE* CONSTR#INT em, +e,tno 1< RE4ERENCES +e,t +e,tno""5 #ns8e-: B 1(. 2hich statement eA,licitl; names a const-aint3 #. #LTER T#BLE stu+ent_:-a+es #DD 4OREINN SE* stu+ent_i+" RE4ERENCES stu+ents stu+ent_i+"5

Page 64 of 81
B. #LTER T#BLE stu+ent_:-a+es #DD CONSTR#INT N#ME C stu+ent_i+_1< 4OREINN SE* stu+ent_i+" RE4ERENCES stu+ents stu+ent_i+"5 C. #LTER T#BLE stu+ent_:-a+es #DD CONSTR#INT stu+ent_i+_1< 4OREINN SE* stu+ent_i+" RE4ERENCES stu+ents stu+ent_i+"5 D. #LTER T#BLE stu+ent :-a+es #DD N#MED CONSTR#INT stu+ent_i+_1< 4OREINN SE* stu+ent_i+" RE4ERENCES stu+ents stu+ent_i+"5 E. #LTER T#BLE stu+ent :-a+es #DD N#ME stu+ent_i+_1< 4OREINN SE* stu+ent_i+" RE4ERENCES stu+ents stu+ent_i+"5 #ns8e-: C 1D. 2hich th-ee statements co--ectl; +esc-ibe the 1unctions an+ use o1 const-aints3 Choose th-ee." #. Const-aints ,-o0i+e +ata in+e,en+ence. B. Const-aints ma<e com,leA Mue-ies eas;. C. Const-aints en1o-ce -ules at the 0ie8 le0el. D. Const-aints en1o-ce -ules at the table le0el. E. Const-aints ,-e0ent the +eletion o1 a table i1 the-e a-e +e,en+encies. 4. Const-aints ,-e0ent the +eletion o1 an in+eA i1 the-e a-e +e,en+encies. #ns8e-: C/ D/ E 1E. 2hich const-aint can be +e1ines onl; at the column le0el3 #. UNI>UE B. NOT NULL C. C%ECS D. )RIM#R* SE* E. 4OREINN SE* #ns8e-: B 1J. 2hich t8o statements about c-eatin: const-aints a-e t-ue3 Choose t8o" #. Const-aint names must sta-t 8ith S*S_C. B. #ll const-aints must be +e1ines at the column le0el. C. Const-aints can be c-eate+ a1te- the table is c-eate+. D. Const-aints can be c-eate+ at the same time the table is c-eate+. E. In1o-mation about const-aints is 1oun+ in the $IE2_CONSTR#INTS +ictiona-; 0ie8. #ns8e-: C/ D Lesson 1': $ie8s 1. To, N anal;sis -eMui-es _____ an+ _____. Choose t8o." #. the use o1 -o8i+ B. a NROU) B* clause

Page 65 of 81
C. an ORDER B* clause D. onl; an inline 0ie8 E. an inline 0ie8 an+ an oute- Mue-; #ns8e-: C/ E &. 2hich ob=ect ,-i0ile:es can be :-ante+ on a 0ie83 #. none B. DELETE/ INSERT/SELECT C. #LTER/ DELETE/ INSERT/ SELECT D. DELETE/ INSERT/ SELECT/ U)D#TE #ns8e-: D 9. 2hat is t-ue about u,+ates th-ou:h a 0ie83 #. *ou cannot u,+ate a 0ie8 8ith :-ou, 1unctions. B. 2hen ;ou u,+ate a 0ie8 :-ou, 1unctions a-e automaticall; com,ute+. C. 2hen ;ou u,+ate a 0ie8 onl; the const-aints on the un+e-l;in: table 8ill be in e11ect. D. 2hen ;ou u,+ate a 0ie8 the const-aints on the 0ie8s al8a;s o0e--i+e the const-aints on the un+e-l;in: tables. #ns8e-: # !. 2hat +oes the 4ORCE o,tion 1o- c-eatin: a 0ie8 +o3 #. c-eates a 0ie8 8ith const-aints B. c-eates a 0ie8 e0en i1 the un+e-l;in: ,a-ent table has const-aints C. c-eates a 0ie8 in anothe- schema e0en i1 ;ou +on7t ha0e ,-i0ile:es D. c-eates a 0ie8 -e:a-+less o1 8hethe- o- not the base tables eAist #ns8e-: D (. 2hich best +esc-ibes an inline 0ie83 #. a schema ob=ect B. a subMue-; that can contain an ORDER B* clause C. anothe- name 1o- a 0ie8 that contains :-ou, 1unctions D. a subMue-; that is ,a-t o1 the 4ROM clause o1 anothe- Mue-; #ns8e-: D D. 2hich t8o statements about 0ie8s a-e t-ue3 Choose t8o." #. # 0ie8 can be c-eate+ as -ea+ onl;. B. # 0ie8 can be c-eate+ as a =oin on t8o o- mo-e tables. C. # 0ie8 cannot ha0e an ORDER B* clause in the SELECT statement. D. # 0ie8 cannot be c-eate+ 8ith a NROU) B* clause in the SELECT statement. E. # 0ie8 must ha0e aliases +e1ine+ 1o- the column names in the SELECT statement.

Page 66 of 81
#ns8e-: #/ B E. *ou c-eate+ a 0ie8 calle+ EM)_DE)T_$U that contains th-ee columns 1-om the EM)LO*EES an+ DE)#RTMENTS tables: EM)LO*EE_ID/ EM)LO*EE_N#ME #ND DE)#RTMENT_N#ME. The DE)#RTMENT_ID column o1 the EM)LO*EES table is the 1o-ei:n <e; to the ,-ima-; <e; DE)#RTMENT_ID column o1 the DE)#RTMENTS table. *ou 8ant to mo+i1; the 0ie8 b; a++in: a 1ou-th column/ M#N#NER_ID o1 NUMBER +ata t;,e 1-om the EM)LO*EES tables. %o8 can ;ou accom,lish this tas<3 #. #LTER $IE2 em,_+e,t_0u #DD mana:e-_i+ NUMBER"5 B. MODI4* $IE2 em,_+e,t_0u #DD mana:e-_i+ NUMBER"5 C. #LTER $IE2 em,_+e,t_0u #S SELECT em,lo;ee_i+/ em,lo;ee_name/ +e,a-tment_name/ mana:e-_i+ 4ROM em,lo;ee e/ +e,a-tments + 2%ERE e.+e,a-tment_i+ C +.+e,a-tment_i+5 D. MODI4* $IE2 em,_+e,t_0u #S SELECT em,lo;ee_i+/ em,lo;ee_name/ +e,a-tment_name/ mana:e-_i+ 4ROM em,lo;ees e/ +e,a-tments + 2%ERE e.+e,a-tment_i+ C +.+e,a-tment_i+5 E. CRE#TE OR RE)L#CE $IE2 em,_+e,t_0u #S SELECT em,lo;ee_i+/ em,lo;ee_name/ +e,a-tment_name/ mana:e-_i+ 4ROM em,lo;ees e/ +e,a-tments + 2%ERE e.+e,a-tment_i+ C +.+e,a-tment_i+5 4. *ou must -emo0e the eAistin: 0ie8 1i-st/ an+ then -un the CRE#TE $IE2 comman+ 8ith a ne8 column list to mo+i1; a 0ie8. #ns8e-: E

J. EAamine the st-uctu-e i1 the EM)LO*EES table: Column name EM)LO*EE_ID EM)_N#ME POB_ID S#L MNR_ID DE)#RTMENT_ID Data T;,e NUMBER $#RC%#R& 9'" $#RC%#R& &'" NUMBER NUMBER NUMBER Rema-<s NOT NULL/ )-ima-; Se; NOT NULL Re1e-ences EM)LO*EE_ID column 4o-ei:n <e; to DE)#RTMENT_ID column o1 the DE)#RTMENTS table

*ou nee+ to c-eate a 0ie8 calle+ EM)_$U that allo8s the use- to inse-t -o8s th-ou:h the 0ie8. 2hich S>L statement/ 8hen use+ to c-eate the EM)_$U 0ie8/ allo8s the useto inse-t -o8s3 #. CRE#TE $IE2 em,_$u #S

Page 67 of 81
SELECT em,lo;ee_i+/ em,_name/ +e,a-tment_i+ 4ROM em,lo;ees 2%ERE m:-_i+ IN 1'&/ 1&'"5 B. CRE#TE $IE2 em,_$u #S SELECT em,lo;ee_i+/ em,_name/ =ob_i+ +e,a-tment_i+ 4ROM em,lo;ees 2%ERE m:-_i+ IN 1'&/ 1&'"5 C. CRE#TE $IE2 em,_$u #S SELECT +e,a-tment_i+/ SUM sal" TOT#LS#L 4ROM em,lo;ees 2%ERE m:-_i+ IN 1'&/ 1&'" NROU) B* +e,a-tment_i+5 D. CRE#TE $IE2 em,_$u #S SELECT em,lo;ee_i+/ em,_name/ =ob_i+/ DISTINCT +e,a-tment_i+ 4ROM em,lo;ees5 #ns8e-: B

Page 68 of 81 K. *ou nee+ to c-eate a 0ie8 EM)_$U. The 0ie8 shoul+ allo8 the use-s to mani,ulate the -eco-+s o1 onl; the em,lo;ees that a-e 8o-<in: 1o- +e,a-tments 1' o- &'.
2hich S>L statement 8oul+ ;ou use to c-eate the 0ie8 EM)_$U3 #. CRE#TE $IE2 em,_0u #S SELECT ? 4ROM em,lo;ees 2%ERE +e,a-tment_i+ IN 1'/&'"5 B. CRE#TE $IE2 em,_0u #S SELECT ? 4ROM em,lo;ees 2%ERE +e,a-tment_i+ IN 1'/&'" 2IT% RE#D ONL*5 C. CRE#TE $IE2 em,_0u #S SELECT ? 4ROM em,lo;ees 2%ERE +e,a-tment_i+ IN 1'/&'" 2IT% C%ECS O)TION5 D. CRE#TE 4ORCE $IE2 em,_0u #S SELECT ? 4ROM em,lo;ees 2%ERE +e,a-tment_i+ IN 1'/&'"5 E. CRE#TE 4ORCE $IE2 em,_0u #S SELECT ? 4ROM em,lo;ees 2%ERE +e,a-tment_i+ IN 1'/&'" NO U)D#TE5 #ns8e-: C 1'. Ma-; has a 0ie8 calle+ EM)_DE)T_LOC_$U that 8as c-eate+ base+ on the EM)LO*EES/ DE)#RTMENTS/ an+ LOC#TIONS tables. She :-ante+ SELECT ,-i0ile:e to Scott on this 0ie8. 2hich o,tion enables Scott to eliminate the nee+ to Muali1; the 0ie8 8ith the name M#R* .EM)_DE)_LOC_$U each time the 0ie8 is -e1e-ence+3 #. Scott can c-eate a s;non;m 1o- the EM)_DE)T_LOC_$U bus usin: the comman+: CRE#TE )RI$#TE S*NON*M EDL_$U 4OR ma-;.EM) DE)T_LOC_$U5 then he can ,-e1iA the columns 8ith this s;non;mn. B. Scott can c-eate a s;non;m 1o- the EM)_DE)T_LOC_$U b; usin: the comman+: CRE#TE S*NON*M EDL_$U 4OR ma-;.EM)_DE)T_LOC_$U5 then he can ,-e1iA the columns 8ith this s;non;m. C. Scott can c-eate a s;non;m 1o- the EM)_DE)T_LOC_$U b; usin: the comman+: CRE#TE LOC#L S*NON*M EDL_$U 4OR ma-;.EM) DE)T_LOC_$U5 then he can ,-e1iA the columns 8ith this s;non;m. D. Scott can c-eate a s;non;m 1o- the EM)_DE)T_LOC_$U b; usin: the comman+:

Page 69 of 81
CRE#TE S*NON*M EDL_$U ON ma-; EM)_DE)T_LOC_$U"5 then he can ,-e1iA the columns 8ith this s;non;m. E. Scott cannot c-eate a s;non;m because s;non;ms can be c-eate+ onl; 1o- tables. 4. Scott cannot c-eate an; s;non;m 1o- Ma-;Gs 0ie8. Ma-; shoul+ c-eate a ,-i0ate s;non;m 1o- the 0ie8 an+ :-ant SELECT ,-i0ile:e on that s;non;m to Scott. #ns8e-: B 11. *ou nee+ to ,e-1o-m ce-tain +ata mani,ulation o,e-ations th-ou:h a 0ie8 calle+ EM)_DE)T_$U/ 8hich ;ou ,-e0iousl; c-eate+. *ou 8ant to loo< at the +e1inition o1 the 0ie8 the SELECT statement on 8hich the 0ie8 8as c-eate." %o8 +o ;ou obtain the +e1inition o1 the 0ie83 #. Use the DESCRIBE comman+ in the EM)_DE)T $U 0ie8. B. Use the DE4INE $IE2 comman+ on the EM)_DE)T $U 0ie8. C. Use the DESCRIBE $IE2 comman+ on the EM)_DE)T $U 0ie8. D. >ue-; the USER_$IE2S +ata +ictiona-; 0ie8 to sea-ch 1o- the EM)_DE)T_$U 0ie8. E. >ue-; the USER_SOURCE +ata +ictiona-; 0ie8 to sea-ch 1o- the EM)_DE)T_$U 0ie8. 4. >ue-; the USER_OBPECTS +ata +ictiona-; 0ie8 to sea-ch 1o- the EM)_DE)T_$U 0ie8. #ns8e-: D 1&. *ou a-e :-ante+ the CRE#TE $IE2 ,-i0ile:e. 2hat +oes this allo8 ;ou to +o3 #. C-eate a table 0ie8. B. C-eate a 0ie8 in an; schema. C. C-eate a 0ie8 in ;ou- schema. D. C-eate a seMuence 0ie8 in an; schema. E. C-eate a 0ie8 that is accessible b; e0e-;one. 4. C-eate a 0ie8 onl; o1 it is base+ on tables that ;ou c-eate+. #ns8e-: C 19. EAamine the st-uctu-e o1 the EM)_DE)T_$U 0ie8: Column Name EM)LO*EE_ID EM)_N#ME POB_ID S#L#R* DE)#RTMENT_ID DE)T_N#ME T;,e NUMBER $#RC%#R& 9'" $#RC%#R& &'" NUMBER NUMBER $#RC%#R& Rema-<s 4-om the EM)LO*EES table 4-om the EM)LO*EES table 4-om the EM)LO*EES table 4-om the EM)LO*EES table 4-om the DE)#RTMENTS table 9'" 4-om the DE)#RTMENTS table

Page 70 of 81
2hich S>L statement ,-o+uces an e--o-3 #. SELECT ? 4ROM em,_+e,t_0u5 B. SELECT +e,a-tment_i+/ SUM sala-;" 4ROM em,_+e,t_0u NROU) B* +e,a-tment_i+5 C. SELECT +e,a-tment_i+/ =ob_i+/ #$N sala-;" 4ROM em,_+e,t_0u NROU) B* +e,a-tment_i+/ =ob_i+5 D. SELECT =ob_i+/ SUM sala-;" 4ROM em,_+e,t_0u 2%ERE +e,a-tment_i+ IN 1'/&'" NROU) B* =ob_i+ %#$INN SUM sala-;" Q &''''5 E. None o1 the statements ,-o+uce an e--o-5 all a-e 0ali+. #ns8e-: E 1!. 2hich S>L statement 8oul+ ;ou use to -emo0e a 0ie8 calle+ EM)_DE)T_$U 1-om ;ou- schema3 #. DRO) em,_+e,t_0u5 B. DELETE em,_+e,t_0u5 C. REMO$E em,_+e,t_0u5 D. DRO) $IE2 em,_+e,t_0u5 E. DELETE $IE2 em,_+e,t_0u5 4. REMO$E $IE2 em,_+e,t_0u5 #ns8e-: D Lesson 11: Othe- Ob=ects 1. 2hich t8o statements about seMuences a-e t-ue3 Choose t8o" #. *ou use a NEWT$#L ,seu+o column to loo< at the neAt ,ossible 0alue that 8oul+ be :ene-ate+ 1-om a seMuence/ 8ithout actuall; -et-ie0in: the 0alue. B. *ou use a CURR$#L ,seu+o column to loo< at the cu--ent 0alue =ust :ene-ate+ 1-om a seMuence/ 8ithout a11ectin: the 1u-the- 0alues to be :ene-ate+ 1-om the seMuence. C. *ou use a NEWT$#L ,seu+o column to obtain the neAt ,ossible 0alue 1-om a seMuence b; actuall; -et-ie0in: the 0alue 1-om the seMuence. D. *ou use a CURR$#L ,seu+o column to :ene-ate a 0alue 1-om a seMuence that 8oul+ be use+ 1o- a s,eci1ie+ +atabase column. E. I1 a seMuence sta-tin: 1-om a 0alue 1'' an+ inc-emente+ b; 1 is use+ b; mo-e then one a,,lication/ then all o1 these a,,lications coul+ ha0e a 0alue o1 1'( assi:ne+ to theicolumn 8hose 0alue is bein: :ene-ate+ b; the seMuence. 4. *ou use REUSE clause 8hen c-eatin: a seMuence to -esta-t the seMuence once it :ene-ates the maAimum 0alue +e1ine+ 1o- the seMuence. #ns8e-: B/ C &. The +atabase a+minist-ato- o1 ;ou- com,an; c-eate+ a ,ublic s;non;m calle+ %R 1othe %UM#N_RESOURCES table o1 the NENER#L schema/ because man; use-s 1-eMuentl; use this table. #s a use- o1 the +atabase/ ;ou c-eate+ a table calle+ %R in ;ou- schema. 2hat ha,,ens 8hen ;ou eAecute this Mue-;3

Page 71 of 81
SELECT ? 4ROM %R5 #. *ou obtain the -esults -et-ie0e+ 1-om the ,ublic s;non;m %R c-eate+ b; the +atabase a+minist-ato-. B. *ou obtain the -esults -et-ie0e+ 1-om the %R table that belon:s to ;ou- schema. C. *ou :et an e--o- messa:e because ;ou cannot -et-ie0e 1-om a table that has the same name as a ,ublic s;non;m. D. *ou obtain the -esults -et-ie0e+ 1-om both the ,ublic s;non;m %R an+ the %R table that belon:s to ;ou- schema/ as a Ca-tesian ,-o+uct. E. *ou obtain the -esults -et-ie0e+ 1-om both the ,ublic s;non;m %R an+ the %R table that belon:s to ;ou- schema/ as a 4ULL POIN. #ns8e-: B 9. In 8hich scena-io 8oul+ in+eA be most use1ul3 #. The in+eAe+ column is +ecla-e+ as NOT NULL. B. The in+eAe+ columns a-e use+ in the 4ROM clause. C. The in+eAe+ columns a-e ,a-t o1 an eA,-ession. D. The in+eAe+ column contains a 8i+e -an:e o1 0alues. #ns8e-: D !. EAamine the st-uctu-e o1 the EM)LO*EES table:
Column name EM)LO*EE_ID L#ST_N#ME 4IRST_N#ME POB_ID S#L MNR_ID DE)#RTMENT_ID Data t;,e NUMBER $#RCN#R& 9'" $#RCN#R& 9'" NUMBER NUMBER NUMBER NUMBER Rema-<s NOT NULL/ )-ima-; Se;

Re1e-ences EM)LO*EE_ID column

*ou nee+ to c-eate an in+eA calle+ N#ME_IDW on the 1i-st name an+ last name 1iel+s o1 the EM)LO*EES table. 2hich S>L statement 8oul+ ;ou use to ,e-1o-m this tas<3 #. CRE#TE INDEW N#ME_IDW 1i-st_name/ last_name"5 B. CRE#TE INDEW N#ME_IDW 1i-st_name #ND last_name"5 C. CRE#TE INDEW N#ME_IDW ON 1i-st_name/ last_name"5 D. CRE#TE INDEW N#ME_IDW ON em,lo;ees 1i-st_name #ND last_name"5 E. CRE#TE INDEW N#ME_IDW ON em,lo;ees 1i-st_name/ last_name"5 4. CRE#TE INDEW N#ME_IDW 4OR em,lo;ees 1i-st_name/ last_name"5 #ns8e-: E (. 2hat a-e t8o -easons to c-eate s;non;ms3 Choose t8o." #. *ou ha0e too man; tables. B. *ou- tables a-e too lon:. C. *ou- tables ha0e +i11icult names. D. *ou 8ant to 8o-< on ;ou- o8n tables. E. *ou 8ant to use anothe- schema7s tables. 4. *ou ha0e too man; columns in ;ou- tables.

Page 72 of 81
#ns8e-: B/ E D. EAamine the st-uctu-e o1 the EM)LO*EES table: EM)LO*EE_ID EM)_N#ME POB_ID S#L MNR_ID DE)#RTMENT_ID NUMBER $#RC%#R& 9'" NUMBER NUMBER NUMBER NUMBER NOT NULL/ )-ima-; Se;

Re1e-ences EM)LO*EE_ID column 4o-ei:n <e; to DE)#RTMENT_ID column o1 the DE)#RTMENTS table

*ou c-eate+ a seMuence calle+ EM)_ID_SE> in o-+e- to ,o,ulate seMuential 0alues 1othe EM)LO*EE_ID column o1 the EM)LO*EES table. 2hich t8o statements -e:a-+in: the EM)_ID_SE> seMuence a-e t-ue3 Choose t8o." #. *ou cannot use the EM)_ID_SE> seMuence to ,o,ulate the POB_ID column. B. The EM)_ID_SE> seMuence is in0ali+ate+ 8hen ;ou mo+i1; the EM)LO*EE_ID column. C. The EM)_ID_SE> seMuence is not a11ecte+ b; mo+i1ications to the EM)LO*EES table. D. #n; othe- column o1 NUMBER +ata t;,e in ;ou- schema can use the EM)_ID_SE> seMuence. E. The EM)_ID_SE> seMuence is +-o,,e+ automaticall; 8hen ;ou +-o, the EM)LO*EES table. 4. The EM)_ID_SE> seMuence is +-o,,e+ automaticall; 8hen ;ou +-o, the EM)LO*EE_ID column. #ns8e-: C/ D E. Use- Ma-; has a 0ie8 calle+ EM)_DE)T_LOC_$U that 8as c-eate+ base+ on the EM)LO*EES/ DE)#RTMENTS/ an+ LOC#TIONS tables. She has the ,-i0ile:e to c-eate a ,ublic s;non;m/ an+ 8oul+ li<e to c-eate a s;non;m 1o- this 0ie8 that can be use+ b; all use-s o1 the +atabase. 2hich S>L statement can Ma-; use to accom,lish that tas<3 #. CRE#TE )UBLIC S*NON*M EDL_$U ON em,_+e,t_loc_0u5 B. CRE#TE )UBLIC S*NON*M EDL:$U 4OR ma-; em,_+e,t_loc_0u"5 C. CRE#TE )UBLIC S*NON*M EDL_$U 4OR em,_+e,t_loc_0u5 D. CRE#TE S*NON*M EDL_$U ON em,_+e,t_loc_0u 4OR E#C% USER5 E. CRE#TE S*NON*M EDL_$U 4OR E#C% USER ON em,_+e,t_loc_0u5 4. CRE#TE )UBLIC S*NON*M EDL_$U ON em,_+e,t_loc_0u 4OR #LL USERS5 #ns8e-: # J. EAamine the statement:
Create synonym emp for hr.employees;

2hat ha,,ens 8hen ;ou issue the statement3 #. #n e--o- is :ene-ate+. B. *ou 8ill ha0e t8o i+entical tables in the %R schema 8ith +i11e-ent names.

Page 73 of 81
C. *ou c-eate a table calle+ em,lo;ees in the %R schema base+ on ;ou EM) table. D. *ou c-eate an alte-nati0e name 1o- the em,lo;ees table in the %R schema in ;ou- o8n schema. #ns8e-: D K. 2hat is t-ue about seMuences3 #. The sta-t 0alue o1 the seMuence is al8a;s 1. B. # seMuence al8a;s inc-ements b; 1. C. The minimum 0alue o1 an ascen+in: seMuence +e1aults to 1. D. The maAimum 0alue o1 +escen+in: seMuence +e1aults to 1. #ns8e-: # 1'. EAamine the S>L statements that c-eates ORDERS table: CRE#TE T#BLE o-+e-s SER_NO NUMBER UNI>UE/ ORDER_ID NUMBER/ ORDER_D#TE D#TE NOT NULL ST#TUS $#RC%#RD& 1'" C%ECS status IN FCREDITG/GC#S%G""/ )ROD_ID_NUMBER RE4ERENCES )RODUCTS )RODUCT_ID"/ ORD_TOT#L NUMBER/ )RIM#R* SE* o-+e- i+/ o-+e- +ate""5 4o- 8hich columns 8oul+ an in+eA be automaticall; c-eate+ 8hen ;ou eAecute the abo0e S>L statement3 Choose t8o" #. SER_NO B. ORDER_ID C. ST#TUS D. )ROD_ID E. ORD_TOT#L 4. Com,osite in+eA on ORDER_ID an+ ORDER_D#TE #ns8e-: #/ 4 11. 2hat is t-ue about seMuences3 #. Once c-eate+/ a seMuence belon:s to a s,eci1ic schema. B. Once c-eate+/ a seMuence is lin<e+ to a s,eci1ic table. C. Once c-eate+/ a seMuence is automaticall; a0ailable to all use-s. D. Onl; the DB# can cont-ol 8hich seMuence is use+ b; a ce-tain table. E. Once c-eate+/ a seMuence is automaticall; use+ in all INSERT an+ U)D#TE statements. #ns8e-: # 1&. EAamine the st-uctu-e o1 the EM)LO*EES table: EM)LO*EE_ID EM)_N#ME POB_ID S#L MNR_ID NUMBER $#RC%#R& 9'" $#RC%#R& &'" NUMBER NUMBER NOT NULL

Page 74 of 81
DE)#RTMENT_ID NUMBER *ou 8ant to c-eate a S>L sc-i,t 1ile that contains an INSERT statement. 2hen the sc-i,t is -un/ the INSERT statement shoul+ inse-t a -o8 8ith the s,eci1ie+ 0alues into the EM)LO*EES table. The INSERT statement shoul+ ,ass 0alues to the table columns as s,eci1ie+ belo8: EM)LO*EE_ID: NeAt 0alue 1-om the seMuence EM)_ID_SE>EM)_N#ME an+ POB_ID: #s s,eci1ie+ b; the use- +u-in: -un time/ th-ou:h substitution 0a-iables S#L: &''' MNR_ID: No 0alue DE)#RTMENT_ID: Su,,lie+ b; the use- +u-in: -un time th-ou:h substitution 0a-iable. The INSERT statement shoul+ 1ail i1 the use- su,,lies a 0alue othe- than &' o- ('. 2hich INSERT statement meets the abo0e -eMui-ements3 #. INSERT INTO em,lo;ees $#LUES em,_i+_seM.NEWT$#L/ 7Zename7/ 7Z=obi+7/ &'''/ NULL/ Z+i+"5 B. INSERT INTO em,lo;ees $#LUES em,_i+_seM.NEWT$#L/ 7Zename7/ 7Z=obi+7/ &'''/ NULL/ Z+i+ IN &'/('""5 C. INSERT INTO SELECT ? 4ROM em,lo;ees 2%ERE +e,a-tment_i+ IN &'/('"" $#LUES em,_i+_seM.NEWT$#L/ 7Zename7/ 7Z=obi+7/ &'''/ NULL/ Z+i+"5 D. INSERT INTO SELECT ? 4ROM em,lo;ees 2%ERE +e,a-tment_i+ IN &'/('" 2IT% C%ECS O)TION" $#LUES em,_i+_seM.NEWT$#L/ 7Zename7/ 7Z=obi+7/ &'''/ NULL/ Z+i+"5 E. INSERT INTO SELECT ? 4ROM em,lo;ees 2%ERE +e,a-tment_i+ C &' #ND +e,a-tment_i+ C ('" 2IT% C%ECS O)TION " $#LUES em,_i+_seM.NEWT$#L/ 7Zename7/ 7Z=obi+7/ &'''/ NULL/ Z+i+"5 #ns8e-: D Lesson 1&: Use- #ccess 1. *ou nee+ to :i0e the M#N#NER -ole the abilit; to select 1-om/ inse-t into/ an+ mo+i1; eAistin: -o8s in the STUDENT_NR#DES table. #n;one :i0en this M#N#NER -ole shoul+ be able to ,ass those ,-i0ile:es on to othe-s. 2hich statement accom,lishes this3 #. NR#NT select/ inse-t/ u,+ate ON stu+ent_:-a+es TO mana:e-5 B. NR#NT select/ inse-t/ u,+ate ON stu+ent_:-a+es TO ROLE mana:e-5 C. NR#NT select/ inse-t/ mo+i1; ON stu+ent_:-a+es TO mana:e- 2IT% NR#NT O)TION5 D. NR#NT select/ inse-t/ u,+ate ON stu+ent_:-a+es TO mana:e- 2IT% NR#NT O)TION5 E. NR#NT select/ inse-t/ u,+ate ON stu+ent_:-a+es TO ROLE mana:e- 2IT% NR#NT O)TION5 4. 4.NR#NT select/ inse-t/ mo+i1; ON stu+ent_:-a+es TO ROLE mana:e- 2IT% NR#NT O)TION5

Page 75 of 81
#ns8e-: D &. EAamine the +esc-i,tion o1 the EM)LO*EES table: EM)_ID L#ST_N#ME 4IRST_N#ME DE)T_ID POB_C#T S#L#R* NUMBER !" NOT NULL $#RC%#R& 9'" NOT NULL $#RC%#R& 9'" NUMBER &" $#RC%#RD& 9'" NUMBER J/&"

2hich statement sho8s the maAimum sala-; ,ai+ in each =ob cate:o-; o1 each +e,a-tment3 #. SELECT +e,t_i+/ =ob_cat/ M#W sala-;" 4ROM em,lo;ees 2%ERE sala-; Q M#W sala-;"5 B. SELECT +e,t_i+/ =ob_cat/ M#W sala-;" 4ROM em,lo;ees NROU) B* +e,t_i+/ =ob_cat5 C. SELECT +e,t_i+/ =ob_cat/ M#W sala-;" 4ROM em,lo;ees5 D. SELECT +e,t_i+/ =ob_cat/ M#W sala-;" 4ROM em,lo;ees NROU) B* +e,t_i+5 E. SELECT +e,t_i+/ =ob_cat/ M#W sala-;" 4ROM em,lo;ees NROU) B* +e,t_i+/ =ob_cat/ sala-;5 #ns8e-: B

Page 76 of 81
9. 2hich +ata +ictiona-; table shoul+ ;ou Mue-; to 0ie8 the ob=ect ,-i0ile:es :-ante+ to the use- on s,eci1ic columns3 #. USER_T#B_)RI$S_M#DE B. USER_T#B_)RI$S C. USER_COL_)RI$S_M#DE D. USER_COL_)RI$S #ns8e-: D !. 2hich t8o statements accu-atel; +esc-ibe a -ole3 Choose t8o." #. # -ole can be :i0en to a maAimum o1 1''' use-s. B. # use- can ha0e access to a maAimum o1 1' -oles. C. # -ole can ha0e a maAimum o1 1'' ,-i0ile:es containe+ in it. D. )-i0ile:es a-e :i0en to a -ole b; usin: the CRE#TE ROLE statement. E. # -ole is a name+ :-ou, o1 -elate+ ,-i0ile:es that can be :-ante+ to the use-. 4. # use- can ha0e access to se0e-al -oles/ an+ se0e-al use-s can be assi:ne+ the same -ole. #ns8e-: D/ 4 (. 2hat is necessa-; 1o- ;ou- Mue-; on an eAistin: 0ie8 to eAecute success1ull;3 #. The un+e-l;in: tables must ha0e +ata. B. *ou nee+ SELECT ,-i0ile:es on the 0ie8. C. The un+e-l;in: tables must be in the same schema. D. *ou nee+ SELECT ,-i0ile:es onl; on the un+e-l;in: tables. #ns8e-: B D. Scott issues the S>L statements: CRE#TE T#BLE +e,t +e,tno NUMBER &"/ +name $#RC%#R& 1!"/ loc $#RC%#R& 19"\5 NR#NT SELECT ON DE)T TO SUE5 I1 Sue nee+s to select 1-om Scott7s DE)T table/ 8hich comman+ shoul+ she use3 #. SELECT ? 4ROM DE)T5 B. SELECT ? 4ROM SCOTT.DE)T5 C. SELECT ? 4ROM DB#.SCOTT.DE)T5 D. SELECT ? 4ROM #LL_USERS 2%ERE USER_N#ME C 7SCOTT7 #ND T#BLE N#ME C 7DE)T75 #ns8e-: B E. 2hich statement c-eates a ne8 use-3 #. CRE#TE USER susan5 B. CRE#TE OR RE)L#CE USER susan5 C. CRE#TE NE2 USER susan DE4#ULT5 D. CRE#TE USER susan IDENTI4IED B* blue5 E. CRE#TE NE2 USER susan IDENTI4IED b; blue5

Page 77 of 81
4. CRE#TE OR RE)L#CE USER susan IDENTI4IED B* blue5 #ns8e-: D J. 2hat is t-ue about the 2IT% NR#NT O)TION clause3 #. It allo8s a :-antee DB# ,-i0ile:es. B. It is -eMui-e+ s;ntaA 1o- ob=ect ,-i0ile:es. C. It allo8s ,-i0ile:es on s,eci1ie+ columns o1 tables. D. It is use+ to :-ant an ob=ect ,-i0ile:e on a 1o-ei:n <e; column. E. It allo8s the :-antee to :-ant ob=ect ,-i0ile:es to othe- use-s an+ -oles. #ns8e-: E K. The DB# issues this S>L comman+: CRE#TE USER scott IDENTI4IES b; ti:e-5 2hat ,-i0ile:es +oes the use- Scott ha0e at this ,oint3 #. No ,-i0ile:es. B. Onl; the SELECT ,-i0ile:e. C. Onl; the CONNECT ,-i0ile:e. D. #ll the ,-i0ile:es o1 a +e1ault use-. #ns8e-: # 1'. *ou a-e the DB# 1o- an aca+emic +atabase. *ou nee+ to c-eate a -ole that allo8s a :-ou, o1 use-s to mo+i1; eAistin: -o8s in the STUDENT_NR#DES table. 2hich set o1 statements accom,lishes this3 #. CRE#TE ROLE -e:ist-a-5 NR#NT MODI4* ON stu+ent_:-a+es TO -e:ist-a-5 NR#NT -e:ist-a- to use-1/ use-&/ use-9 B. CRE#TE NE2 ROLE -e:ist-a-5 NR#NT #LL ON stu+ent_:-a+es TO -e:ist-a-5 NR#NT -e:ist-a- to use-1/ use-&/ use-9 C. CRE#TE ROLE -e:ist-a-5 NR#NT U)D#TE ON stu+ent_:-a+es TO -e:ist-a-5 NR#NT ROLE -e:ist-a- to use-1/ use-&/ use-9 D. CRE#TE ROLE -e:ist-a-5 NR#NT U)D#TE ON stu+ent_:-a+es TO -e:ist-a-5 NR#NT -e:ist-a- to use-1/ use-&/ use-95 E. CRE#TE -e:ist-a-5 NR#NT C%#NNE ON stu+ent_:-a+es TO -e:ist-a-5 NR#NT -e:ist-a-5 #ns8e-: D 11. The use- Sue issues this S>L statement: NR#NT SELECT ON sue.EM) TO alice 2IT% NR#NT O)TION5 The use- #lice issues this S>L statement: NR#NT SELECT ON sue.EM) TO -eena 2IT% NR#NT O)TION5 The use- Reena issues this S>L statement: NR#NT SELECT ON sue.EM) TO timbe-5 The use- Sue issues this S>L statement: RE$OSE select on sue.EM) 4ROM alice5

Page 78 of 81
4o- 8hich use-s +oes the -e0o<e comman+ -e0o<e SELECT ,-i0ile:es on the SUE.EM) table3 #. #lice onl; B. #lice an+ Reena C. #lice/ Reena/ an+ TimbeD. Sue/ #lice/ Reena/ an+ Timbe#ns8e-: C 1&. The DB# issues this S>L comman+: CRE#TE USER scott IDENTI4IED b; ti:e-5 2hat ,-i0ile:es +oes the use- Scott ha0e at this ,oint3 #. no ,-i0ile:es B. onl; the SELECT ,-i0ile:e C. onl; the CONNECT ,-i0ile:e D. all the ,-i0ile:es o1 a +e1ault use#ns8e-: # 19. The DB# issues this S>L comman+: CRE#TE USER scott IDENTI4IED b; ti:e-5 2hat ,-i0ile:es +oes the use- Scott ha0e at this ,oint3 #. no ,-i0ile:es B. onl; the SELECT ,-i0ile:e C. onl; the CONNECT ,-i0ile:e D. all the ,-i0ile:es o1 a +e1ault use#ns8e-: # 1!. EAamine the statement: NR#NT select/ inse-t/ u,+ate ON stu+ent_:-a+es TO mana:e2IT% NR#NT O)TION5 2hich t8o a-e t-ue3 Choose t8o." #. M#N#NER must be a -ole. B. It allo8s the M#N#NER to ,ass the s,eci1ie+ ,-i0ile:es on to othe- use-s. C. It allo8s the M#N#NER to c-eate tables that -e1e- to the STUDENT_NR#DES table. D. It allo8s the M#N#NER to a,,l; all DML statements on the STUDENT_NR#DES table. E. It allo8s the M#N#NER the abilit; to select 1-om/ inse-t into/ an+ u,+ate the STUDENT_NR#DES table. 4. It allo8s the M#N#NER the abilit; to select 1-om/ +elete 1-om/ an+ u,+ate the STUDENT_NR#DES table.

Page 79 of 81
#ns8e-: B/ E 1(. The use- #lice 8ants to :-ant all use-s Mue-; ,-i0ile:es on he- DE)T table. 2hich S>L statement accom,lishes this3 #. NR#NT select ON +e,t TO #LL_USERS5 B. NR#NT select ON +e,t TO #LL5 C. NR#NT >UER* ON +e,t TO #LL_USERS D. NR#NT select ON +e,t TO )UBLIC5 #ns8e-: D 1D. 2hich ob=ect ,-i0ile:es can be :-ante+ on a 0ie83 #. none B. DELETE/ INSERT/SELECT C. #LTER/ DELETE/ INSERT/ SELECT D. DELETE/ INSERT/ SELECT/ U)D#TE #ns8e-: D 1E. 2hich one is a s;stem ,-i0ile:e3 #. SELECT B. DELETE C. EWECUTE D. #LTER T#BLE E. CRE#TE T#BLE #ns8e-: E 1J. EAamine these statements: CRE#TE ROLE -e:ist-a-5 NR#NT U)D#TE ON stu+ent_:-a+es TO -e:ist-a-5 NR#NT -e:ist-a- to use-1/ use-&/ use-95 2hat +oes this set o1 S>L statements +o3 #. The set o1 statements contains an e--o- an+ +oes not 8o-<. B. It c-eates a -ole calle+ RENISTR#R/ a++s the MODI4* ,-i0ile:e on the STUDENT_NR#DES ob=ect to the -ole/ an+ :i0es the RENISTR#R -ole to th-ee use-s. C. It c-eates a -ole calle+ RENISTR#R/ a++s the U)D#TE ,-i0ile:e on the STUDENT_NR#DES ob=ect to the -ole/ an+ :i0es the RENISTR#R -ole to th-ee use-s. D. It c-eates a -ole calle+ RENISTR#R/ a++s the U)D#TE ,-i0ile:e on the STUDENT_NR#DES ob=ect to the -ole/ an+ c-eates th-ee use-s 8ith the -ole. E. It c-eates a -ole calle+ RENISTR#R/ a++s the U)D#TE ,-i0ile:e on th-ee use-s/ an+ :i0es

Page 80 of 81
the RENISTR#R -ole to the STUDENT_NR#DES ob=ect. 4. It c-eates a -ole calle+ STUDENT_NR#DES/ a++s the U)D#TE ,-i0ile:e on th-ee use-s/ an+ :i0es the U)D#TE -ole to the -e:ist-a-. #ns8e-: C Lesson 19: )-o+ucin: Rea+able Out,ut 8ith iS>L?)lus 1. 2hich iS>L?)lus 1eatu-e can be use+ to -e,lace 0alues in the 2%ERE clause3 #. Substitution 0a-iables B. Re,lacement 0a-iables C. )-om,t 0a-iables D. Instea+Oo1 0a-iables E. This 1eatu-e cannot be im,lemente+ th-ou:h iS>L?)lus. #ns8e-: # &. 2hich substitution 0a-iable 8oul+ ;ou use i1 ;ou 8ant to -euse the 0a-iable 8ithout ,-om,tin: the use- each time3 #. Z B. #CCE)T C. )ROM)T D. ZZ #ns8e-: D 9. 2hich S>L statement acce,ts use- in,ut 1o- the columns to be +is,la;e+/ the table name/ an+ 2%ERE con+ition3 #. SELECT Z1/ .Z&. 4ROM Z9 2%ERE last_name C 7Z!75 B. SELECT Z1/ 7Z&7 4ROM Z9 2%ERE 7Zlast_name C 7Z!7 75 C. SELECT Z1/ Z& 4ROM Z9 2%ERE last_name C 7Z!75 D. SELECT Z1/ 7Z&7 4ROM EM) 2%ERE last_name C 7Z!75 #ns8e-: C

Page 81 of 81
!. 2hich is an iS>L?)lus comman+3 #. INSERT B. U)D#TE C. SELECT D. DESCRIBE E. DELETE 4. REN#ME #ns8e-: D (. EAamine this statement: SELECT stu+ent_i+/ :,a 4ROM stu+ent_:-a+es 2%ERE :,a Q ZZ0alue5 *ou -un the statement once/ an+ 8hen ,-om,te+ ;ou ente- a 0alue o1 &.'. # -e,o-t is ,-o+uce+. 2hat ha,,ens 8hen ;ou -un the statement a secon+ time3 #. #n e--o- is -etu-ne+. B. *ou a-e ,-om,te+ to ente- a ne8 0alue. C. # -e,o-t is ,-o+uce+ that matches the 1i-st -e,o-t ,-o+uce+. D. *ou a-e as<e+ 8hethe- ;ou 8ant a ne8 0alue o- i1 ;ou 8ant to -un the -e,o-t base+ on the ,-e0ious 0alue. #ns8e-: C D. 2hich a-e iS>L?)lus comman+s3 Choose all that a,,l;." #. INSERT B. U)D#TE C. SELECT D. DESCRIBE E. DELETE 4. REN#ME #ns8e-: D E. 2hich is an iS>L?)lus comman+3 #. INSERT B. U)D#TE C. SELECT D. DESCRIBE E. DELETE 4. REN#ME #ns8e-: D

You might also like