Section 6 Quiz
-
Upload
sinta-indriani -
Category
Documents
-
view
219 -
download
0
Transcript of Section 6 Quiz
-
8/15/2019 Section 6 Quiz
1/32
Section 6 Quiz(Answer all questions in this section)
1.You need to join the EMPLYEE!"#S$ and EMPLYEES ta%les.$he EMPLYEE!"#S$ ta%le will %e the &irst ta%le in the 'M
clause. All the atched and unatched rows in the EMPLYEESta%le need to %e dis*la+ed. ,hich t+*e o& join will +ou use-
Mar &or e/iew
(1) Points
A le&t outer join
An inner join
A cross join
A ri0ht outer join ()
2orrect
3.,hich quer+ re*resents the correct s+nta4 &or a le&t outer join- Mar &or e/iew
(1) Points
SELE2$ co*an+nae5 orderdate5 total'M custoers cLE'$ #7 orders o7 c.cust!id 8 o.cust!id9SELE2$ co*an+nae5 orderdate5 total'M custoers c:$E #7 orders o
7 c.cust!id 8 o.cust!id9SELE2$ co*an+nae5 orderdate5 total'M custoers cLE'$ :$E #7 orders o7 c.cust!id 8 o.cust!id9
()
SELE2$ co*an+nae5 orderdate5 total'M custoers cLE'$ :$E orders o
7 c.cust!id 8 o.cust!id9
2orrect
;.'or which o& the &ollowin0 ta%les will all the /alues %e retrie/ed e/eni& there is no atch in the other-
Mar &or e/iew
(1) Points
-
8/15/2019 Section 6 Quiz
2/32
SELE2$ e.last!nae5 e.de*artent!id5 d.de*artent!nae'M e*lo+ees eLE'$ :$E #7 de*artents d7 (e.de*artent!id 8 d.de*artent!id)9
e*lo+ees ()
de*artent
7either. $he LE'$ :$E #7 liits the /alue to the atchin0de*artent ids.
Name Null? Type
EMPLYEE!#? 7$ 7:LL 7:M
-
8/15/2019 Section 6 Quiz
3/32
SELE2$ d.de*artent!id5 e.&irst!nae5 e.last!nae'M e*lo+ees eLE'$ :$E #7 de*artents d,"EE (e.de*artent!id 8 d.de*artent!id)9SELE2$ d.de*artent!id5 e.&irst!nae5 e.last!nae
'M e*lo+ees e#C"$ :$E #7 de*artents d7 (e.e*lo+ee!id 8 d.ana0er!id)9
()
2orrect
B.,hich o& the &ollowin0 data%ase desi0n conce*ts do +ou need in +ourta%les to write "ierarchical queries-
Mar &or e/iew
(1) Points
7on$rans&era%ilit+
Arc
ecursi/e elationshi* ()
Su*ert+*e
2orrectSection 6 Quiz
(Answer all questions in this section)
6. ,hich o& the &ollowin0 data%ase desi0n conce*ts is i*leentedwith a sel& join-
Mar &or e/iew
(1) Points
7on$rans&era%ilit+
Su*ert+*e
Arc
ecursi/e elationshi* ()
#ncorrect. e&er to Section 6 Lesson =.
F. "ierarchical queries can wal %oth $o*?own and
-
8/15/2019 Section 6 Quiz
4/32
'alse
2orrect
G. ,hich stateent a%out a sel& join is true- Mar &or e/iew
(1) Points
$a%le aliases cannot %e used to quali&+ ta%le naes.
$he 7A$:AL #7 clause ust %e used.
$a%le aliases ust %e used to quali&+ ta%le naes. ()
A sel& join ust %e i*leented %+ de&inin0 a /iew.
2orrect
D. E/aluate this SELE2$ stateent>
SELE2$ 'M e*lo+ee e5 e*lo+ee ,"EE e.0r!id 8 .e*!id9,hich t+*e o& join is created %+ this SELE2$ stateent-
Mar &or e/iew
(1) Points
a &ull outer join
a sel& join ()
a le&t outer joina cross join
2orrect
1.$he !!!!!!!!!!! join is the A7S#standard s+nta4 used to 0eneratea 2artesian *roduct.
Mar &or e/iew
(1) Points
ALL
2SS () 7A$:AL
':LL
2orrectSection 6 Quiz
(Answer all questions in this section)
-
8/15/2019 Section 6 Quiz
5/32
-
8/15/2019 Section 6 Quiz
6/32
,"E7
:S#7C ()
2orrect
1B.
P?:2$SP?:2$!#? 7:M
-
8/15/2019 Section 6 Quiz
7/32
?E
-
8/15/2019 Section 6 Quiz
8/32
-
8/15/2019 Section 6 Quiz
9/32
Section F Quiz(Answer all questions in this section)
6. $o *er&or a /alid outer join %etween ?EPAME7$S and EM
SELE2$ d.de*artent!nae5 e.last!nae'M e*lo+ees e5 de*artents d,"EE
e.de*artent!id 8 d.de*artent!i
e.de*artent!id(H) 8 d.de*arten
e.de*artent!id 8 d.de*artent!i
e.de*artent!id(H) 8 d.de*arten
2orrect
F. ,hich o& the &ollowin0 %est descri%es the &unction o& an outer j
An outer join will return onl+ thos
An outer join will return onl+ data
An outer join will return data onl+
An outer join will return all rows
2orrect
G. You ha/e the &ollowin0 EMPLYEES ta%le>
EMPLYEE!#? 7:M
-
8/15/2019 Section 6 Quiz
10/32
-
8/15/2019 Section 6 Quiz
11/32
7e/er
2orrect
Pa0e 3 o& ;
Section F Quiz(Answer all questions in this section)
11. ,hat is the result o& a quer+ that selects &ro two ta%les %ut inc
A selection o& rows &ro the &irst
A 2artesian *roduct ()
A selection o& atched rows &ro
A s+nta4 error
2orrect
13. $he PA$#E7$S and ?2$S ta%les contain these coluns>
PA$#E7$SPA$#E7$!#? 7:M
-
8/15/2019 Section 6 Quiz
12/32
A s+nta4 error
A re*ort containin0 each *atients
A re*ort with 7 du*licate PA$#E
2orrect
1;. E/aluate this SQL stateent>
SELE2$ e.e*lo+ee!id5 e.last!nae5 e.&irst!nae5 d.de*arte'M e*lo+ees e5 de*artents d,"EE e.de*artent!id 8 d.de*artent!id A7? e*lo+ees.d?E
-
8/15/2019 Section 6 Quiz
13/32
A 2artesian *roduct ()
2orrect
Pa0e ; o& ;
Section G Quiz(Answer all questions in this section)
1.$he EMPLYEES ta%le contains these coluns>
EMPLYEE!#? 7:M
-
8/15/2019 Section 6 Quiz
14/32
3.E/aluate this SELE2$ stateent>
SELE2$ 2:7$()'M e*lo+ees,"EE salar+ I ;9
,hich result will the quer+ dis*la+-
Mar &or e/iew
(1) Points
$he total o& the SALAY colun &or all e*lo+ees that ha/e asalar+ 0reater than ;$he quer+ 0enerates an error and returns no results.
$he nu%er o& e*lo+ees that ha/e a salar+ less than ;
$he nu%er o& rows in the EMPLYEES ta%le that ha/e a salar+0reater than ; ()
2orrect
;.$o include null /alues in the calculations o& a 0rou* &unction5 +ouust>
Mar &or e/iew
(1) Points
Precede the 0rou* &unction nae with 7:LL
2on/ert the null to a /alue usin0 the 7@L( ) &unction ()
2ount the nu%er o& null /alues in that colun usin0 2:7$
Crou* &unctions can ne/er use null /alues
2orrect
=.E/aluate this SQL stateent>
SELE2$ 2:7$ (aount)'M in/entor+9
,hat will occur when the stateent is issued-
Mar &or e/iew
(1) Points
$he stateent will return the total nu%er o& rows in theAM:7$ colun.$he stateent will return the 0reatest /alue in the #7@E7$Yta%le.$he stateent will count the nu%er o& rows in the #7@E7$Yta%le where the AM:7$ colun is not null. ()$he stateent will re*lace all 7:LL /alues that e4ist in theAM:7$ colun.
-
8/15/2019 Section 6 Quiz
15/32
2orrect
B.,hat would the &ollowin0 SQL stateent return-
SELE2$ 2:7$(?#S$#72$ salar+)'M e*lo+ees9
Mar &or e/iew
(1) Points
$he total nu%er o& rows in the e*lo+ees ta%le
A listin0 o& all unique salaries in the e*lo+ees ta%le
$he total aount o& salaries in the e*lo+ees ta%le
$he nu%er o& unique salaries in the e*lo+ees ta%le ()
2orrect
Pa0e 1 o& ;
Section G Quiz(Answer all questions in this section)
6. $he S$YLES ta%le contains this data>
S$YLE!#? S$YLE!7AME 2A$ECY 2S$
GDBG= SA7?AL GBD= 13.
D6GDB SA7?AL GBDD 1.
G6DB6 SA7?AL GD6D 1B.
GDD LA'E GDDG 1.
GDGD LA'E GDFGD 1=.
GBF6GD "EEL GBD= 11.
FBGD6 SA7?AL G6DFD
You issue this SELE2$ stateent>
SELE2$ 2:7$(cate0or+)'M st+les9
,hich /alue is dis*la+ed-
Mar &or e/iew
(1) Points
$he stateent will 7$ e4ecute success&ull+.
F ()
-
8/15/2019 Section 6 Quiz
16/32
6
2orrect
F. :sin0 +our e4istin0 nowled0e o& the e*lo+ees ta%le5
would the &ollowin0 two stateents *roduce the saeresult-
SELE2$ 2:7$()'M e*lo+ees9
SELE2$ 2:7$(coission!*ct)'M e*lo+ees9
Mar &or e/iew
(1) Points
Yes
7o ()
$he second stateent is in/alid
$he &irst stateent is in/alid
2orrect
G. You can use C:P &unctions in all clauses o& aSELE2$ stateent. $rue or 'alse-
Mar &or e/iew
(1) Points
$rue'alse ()
2orrect
D. Ci/en the &ollowin0 data in the e*lo+ees ta%le(e*lo+ee!id5 salar+5 coission!*ct)
?A$A> (1=;5 365 null1==5 3B5 null1=D5 1B5 .31F=5 115 .;1F65 G65 .31FG5 F5 .1B)
,hat is the result o& the &ollowin0 stateent>
Mar &or e/iew
(1) Points
-
8/15/2019 Section 6 Quiz
17/32
SELE2$ S:M(coission!*ct)5 2:7$(salar+)'M e*lo+ees,"EE e*lo+ee!id #7( 1=;51==51=D51F=51F651FG)9
S:M 8 1.GB and 2:7$ 8 6
S:M 8 1.GB and 2:7$ 8=
S:M 8 .GB and 2:7$ 8 6 ()
S:M 8 .GB and 2:7$ 8 =
#ncorrect. e&er to Section G Lesson 1.
1. ,hat two 0rou* &unctions can %e used with an+datat+*e-
Mar &or e/iew
(1) Points
2:7$5 S:M
S:M5 A@C
S$??E@5 @A#A72E
M#75 MAO ()
2orrect
Pa0e 3 o& ;
Section G Quiz(Answer all questions in this section)
11. ,hich 0rou* &unction would +ou use to dis*la+ the lowest /alu
M#7 ()
2:7$
A@C
-
8/15/2019 Section 6 Quiz
18/32
MAO
2orrect
13. $he EMPLYEES ta%le contains these coluns>
EMPLYEE!#? 7:M (1=;5 365 null1==5 3B5 null1=D5 1B5 .3
-
8/15/2019 Section 6 Quiz
19/32
1F=5 115 .;1F65 G65 .31FG5 F5 .1B)
,hat is the result o& the &ollowin0 stateent>
SELE2$ A@C(coission!*ct)'M e*lo+ees,"EE e*lo+ee!id #7( 1=;51==51=D51F=51F651FG)9
.313B ()
1.313B
.=3B
$his stateent is in/alid
2orrect
1B. ,hich 0rou* &unctions %elow act on character5 nu%er5 and dat
(2hoose all correct answers)
A@C
S:M
2:7$ ()
MAO ()
M#7 ()
2orrect
Pa0e ; o& ;
Section D Quiz(Answer all questions in this section)
1. $he P?:2$S ta%le contains these coluns>
P?:2$!#? 7:M
-
8/15/2019 Section 6 Quiz
20/32
2A$ECY!#? @A2"A3(1)L2A$#7!#? 7:M
-
8/15/2019 Section 6 Quiz
21/32
SELE2$ 2:7$(*a+ent!id)'M *a+ent,"EE *a+ent!date
-
8/15/2019 Section 6 Quiz
22/32
()
2orrect
=. You want to write a re*ort that returns the a/era0e salar+ o& all e*lo+e$he EMPLYEES ta%le contains the &ollowin0 coluns>
EMPLYEES>EMP!#? 7:M
-
8/15/2019 Section 6 Quiz
23/32
You want to create a re*ort that includes each e*lo+ees last nae5 e*,hich o& the &ollowin0 SELE2$ stateents will acco*lish this tas-
SELE2$ e*lo+ee!id5 last!nae5 hire!da'M e*lo+ees,"EE salar+ I =A7? (s+sdatehire!date) ;6B I 19
()
SELE2$ e*lo+ee!id5 last!nae5 hire!da'M e*lo+ees,"EE salar+ I = A7? hire!date 8
(SELE2$ hire!date
'M e*lo+ees,"EE (s+sdatehire!date) ;6B I 1)9SELE2$ e*lo+ee!id5 last!nae5 salar+'M e*lo+ees,"EE salar+ I =A7? hire!date 8
(SELE2$ hire!date'M e*lo+ees,"EE (s+sdatehire!date) ;6B I 1)9
SELE2$ e*lo+ee!id5 last!nae5 salar+'M e*lo+ees,"EE salar+ I =A7? hire!date #7 (s+sdatehire!date) ;6
2orrect
Pa0e 1 o& ;
Section D Quiz(Answer all questions in this section)
6. E/aluate this SELE2$ stateent>
SELE2$ 2:7$(e*lo+ee!id)5 de*artent!id'M e*lo+eesC:P
-
8/15/2019 Section 6 Quiz
24/32
stateent-
,"EE salar+ I 1B ()
"A@#7C S:M(salar+) I 1B,"EE S:M(salar+) I 1B
"A@#7C salar+ I 1B
2orrect
F. $he di&&erence %etween :7#7 and :7#7 ALL is Mar &or e/iew
(1) Points
$here is no di&&erence9 +ou 0et e4actl+ the saeresult &ro %oth.:7#7 ALL is ore lie a 7A$:AL #7.
:7#7 will reo/e du*licates9 :7#7 ALL returnsall rows &ro all queries includin0 the du*licates. ():7#7 is a s+no+ &or :7#7 ALL.
2orrect
G. ,hen usin0 SE$ o*erators5 the nu%er o& coluns andthe data t+*es o& the coluns ust %e identical in all o&the SELE2$ stateents used in the quer+. $rue or 'alse.
Mar &or e/iew
(1) Points
$rue ()
'alse
2orrect
D. ,hich o& the &ollowin0 are correct SE$ o*erators-(choose two)
Mar &or e/iew
(1) Points
(2hoose all correct answers)
:7#7 ALL5 PL:S ALL
:7#7 ALL5 #7$ESE2$ ()
M#7:S5 PL:S
:7#75 M#7:S ()
-
8/15/2019 Section 6 Quiz
25/32
2orrect
1. #& +ou want to include su%totals and 0rand totals &or allcoluns entioned in a C:P
-
8/15/2019 Section 6 Quiz
26/32
1;. E4aine the &ollowin0 stateent>
SELE2$ de*artent!id5 ana0er!id5 jo%!id5 S:M(salar+)'M e*lo+eesC:P
*roduce a sin0le result set
*roduce su%total /alues ()
crossta%ulate /alues
2orrect
1B. You use C:P#7C &unctions to>
A00re0ate rows usin0 S:M5 M#7
#denti&+ the e4tra row /alues creat
Produce su%total and crossta%ula
2orrect
Pa0e ; o& ;
Section 1 Quiz
-
8/15/2019 Section 6 Quiz
27/32
-
8/15/2019 Section 6 Quiz
28/32
-
8/15/2019 Section 6 Quiz
29/32
'alse- (1) Points
$rue ()
'alse
2orrect
D. ,hich stateent is &alse- Mar &or e/iew
(1) Points
$he ,#$" clause stores the results &or the user who runs thequer+.$he ,#$" clause retrie/es the results o& one or ore quer+ %locs.$he ,#$" clause decreases *er&orance. ()
$he ,#$" clause aes the quer+ si*le to read.
2orrect
1.$he EMPLYEES and ?ES ta%les contain these coluns>
EMPLYEESEMPLYEE!#? 7:M
-
8/15/2019 Section 6 Quiz
30/32
-
8/15/2019 Section 6 Quiz
31/32
-
8/15/2019 Section 6 Quiz
32/32
1=.#& a sin0lerow su%quer+ returns a null /alue and uses the equalit+co*arison o*erator5 what will the outer quer+ return-
Mar &or e/iew
(1) Points
All the rows in the ta%leAn error
A null /alue
7o rows ()
2orrect
1B.Su%queries are liited to &our *er SQL transaction. $rue or 'alse- Mar &or e/iew
(1) Points
$rue
'alse ()
2orrect
Pa0e ; o& ;