raspunsuri oracle midterm exam

Upload: zuzudeeia

Post on 13-Apr-2018

245 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/27/2019 Raspunsuri Oracle midterm exam

    1/21

    Section 12

    1. Entity integrity refers to Mark for Review(1) Points

    Tables always containing text data

    Tables always containing n!eric data

    "ol!ns #aving Pri!ary $eys% &oreign $eys% 'nie $eys and "#eck constraints

    defined in t#e database.

    Tables #aving Pri!ary $eys% &oreign $eys% 'nie $eys and "#eck constraintsdefined in t#e database. ()

    *ncorrect. Refer to Section 12

    2. T#e ex+lanation below is a 'ser ,efined integrity rle and !st t#erefore be

    !anally coded% t#e ,atabase cannot enforce t#is rle ato!atically-

    +ri!ary key !st be nie% and no +art of t#e +ri!ary key can be nll. Tre or &alse/Mark for Review

    (1) Points

    Tre

    &alse ()

    "orrect

    0. T#e ex+lanation below is a col!n integrity constraint-

    col!n !st contain only vales consistent wit# t#e defined data for!at of t#e

    col!n. Tre or &alse/Mark for Review

    (1) Points

    Tre ()

    &alse

    "orrect

  • 7/27/2019 Raspunsuri Oracle midterm exam

    2/21

    . T#e text below is an exa!+le of w#at constraint ty+e-

    T#e vale in t#e !anagerid col!n of t#e EMP345EES table !st !atc# a vale int#e e!+loyeeid col!n in t#e EMP345EES table.

    Mark for Review

    (1) Points

    Entity integrity

    'ser6defined integrity

    "ol!n integrity

    Referential integrity ()

    "orrect

    7. n 8rc *!+le!entation8 can be done 9st like any ot#er Relations#i+ 6 yo si!+ly

    add t#e reired &oreign $eys. Tre or &alse/ Mark for Review

    (1) Points

    Tre

    &alse ()

    "orrect

    :. ;#ic# of t#e following are reasons w#y yo s#old consider sing a Sbty+e*!+le!entation/ Mark for Review

    (1) Points

    T#e reslting table will reside in a single database and be sed by 9st 4

  • 7/27/2019 Raspunsuri Oracle midterm exam

    3/21

    >. ;#at do yo create w#en yo transfor! a !any to !any relations#i+ fro! yor ERdiagra! into a +#ysical design/ Mark for Review

    (1) Points

    'nie key constraints

    *ntersection entity

    *ntersection table ()

    Two tables wit# &oreign key constraints between t#e!

    "orrect

    ?. 4ne6to64ne relations#i+s are transfor!ed into "#eck "onstraints in t#e tablescreated at eit#er end of t#at relations#i+. Tre or &alse/ Mark for Review

    (1) Points

    Tre

    &alse ()

    "orrect

    @. ;#y wold t#is table na!e

  • 7/27/2019 Raspunsuri Oracle midterm exam

    4/21

    1B. T#e transfor!ation fro! an ER diagra! to a +#ysical design involves c#anging

    ter!inology. Secondary 'nie *dentifiers beco!e Mark for Review

    (1) Points

    "ol!ns

    Tables

    'nie "onstraints ()

    Pri!ary $ey "onstraints

    "orrect

    Section 12

    11. *n a +#ysical data !odel% a relations#i+ is re+resented as a co!bination of- ("#oose

    Two) Mark for Review(1) Points

    ("#oose all correct answers)

    "ol!n

    Pri!ary $ey or 'nie $ey ()

    "#eck "onstraint or 'nie $ey

    &oreign $ey ()

    *ncorrect. Refer to Section 12

    Section 10

    12. ;#at co!!and can be sed to create a new row in a table in t#e database/ Mark

    for Review

    (1) Points

    "RETE

  • 7/27/2019 Raspunsuri Oracle midterm exam

    5/21

    ,,

    *

  • 7/27/2019 Raspunsuri Oracle midterm exam

    6/21

    (1) Points

    ;#en all non6'*, attribtes are de+endent +on t#e entire '*,. ()

    ;#en no attritibtes are !tally inde+endant and flly inde+endent on t#e +ri!ary

    key.

    ;#en no attritibtes are !tally inde+endent and all are flly de+endent on t#e

    +ri!ary key.

    . ;#ic# SG3 state!ent will retrn an error/ Mark for Review(1) Points

    SE3 &R skyI ()

    select star fro! skyI

    SE3E"T star &R4M skyI

  • 7/27/2019 Raspunsuri Oracle midterm exam

    7/21

    SE3E"T &R4M skyI

    *ncorrect. See Section 1:

    1?. 5o want to create a list of all alb!s t#at #ave been +rodced by t#e co!+any.

    T#e list s#old inclde t#e title of t#e alb!% t#e artists na!e% and t#e date t#e alb!was released. T#e 3='MS table incldes t#e following col!ns-

    3=T*T3E DR"CR2(17B)

  • 7/27/2019 Raspunsuri Oracle midterm exam

    8/21

    To insert data

    To view data ()

    To dis+lay t#e table strctre

    To delete data

    "orrect.

    2B. ;#en listing col!ns in t#e SE3E"T list% w#at s#old yo se to se+arate t#e

    col!ns/ Mark for Review

    (1) Points

    "o!!as ()

    Se!icolons

    ,as#es

    'nderscores

    *ncorrect. See Section 1:

    Section 1:

    21. T#e EMP345EES table contains t#ese col!ns-

    S3R5

  • 7/27/2019 Raspunsuri Oracle midterm exam

    9/21

    2.

    SE3E"T (salary A bons ) A co!!ission+ct (salary 6 bons) inco!e

    &R4M e!+loyeesI

    ;#at will be t#e reslt/

    Mark for Review(1) Points

    State!ent 1 will retrn a #ig#er vale t#an state!ent 2.

    State!ent 2 will retrn a #ig#er vale t#an state!ent 1. ()

    State!ent 1 will dis+lay a different col!n #eading.

    4ne of t#e state!ents will

    20. Evalate t#is SE3E"T state!ent-

    SE3E"T lastna!e% firstna!e% salary

    &R4M e!+loyeesI

    Cow will t#e #eading for t#e S3R5 col!n a++ear in t#e dis+lay by defalt in 4racle

    ++lication Ex+ress/

    Mark for Review

  • 7/27/2019 Raspunsuri Oracle midterm exam

    10/21

    (1) Points

    T#e #eading will dis+lay wit# t#e first c#aracter ca+italiFed and centered.

    T#e #eading will dis+lay wit# t#e first c#aracter ca+italiFed and left 9stified.

    T#e #eading will dis+lay as ++ercase and centered. ()

    T#e #eading will dis+lay as ++ercase and left 9stified.

    *ncorrect. See Section 1>.

    2. 5o need to dis+lay all t#e e!+loyees w#ose last na!e starts wit# t#e letters S! .

    ;#ic# ;CERE clase s#old yo se/ Mark for Review

    (1) Points

    ;CERE lastna!e 3*$E S!J ()

    ;CERE lastna!e 3*$E JS!

    ;CERE lastna!e 3*$E S!

    ;CERE lastna!e 3*$E S!

    *ncorrect. See Section 1>

    27. 5o want to deter!ine t#e orders t#at #ave been +laced by csto!ers w#o reside in

    "#icago. 5o write t#is +artial SE3E"T state!ent-SE3E"T orderid% orderdate% total

    &R4M ordersI

    ;#at s#old yo inclde in yor SE3E"T state!ent to ac#ieve t#e desired reslts/Mark for Review

    (1) Points

  • 7/27/2019 Raspunsuri Oracle midterm exam

    11/21

    "orrect.

    2:. ;#ic# SE3E"T state!ent will dis+lay bot# nie and non6nie co!binationsof t#e M

  • 7/27/2019 Raspunsuri Oracle midterm exam

    12/21

    *ncorrect. See Section 1>.

    2?. T#e ST',E

  • 7/27/2019 Raspunsuri Oracle midterm exam

    13/21

    &*RST.

    Section 1>

    01. T#e "oncatenation 4+erator does w#ic# of t#e following/ Mark for Review

    (1) Points

    3inks rows of data toget#er inside t#e database.

    3inks two or !ore col!ns or literals to for! a single ot+t col!n ()

    *s re+resented by t#e asterisk () sy!bol

    Se+arates col!ns.

    *ncorrect. See Section 1>

    02. 5o need to dis+lay only nie co!binations of t#e 3ST

  • 7/27/2019 Raspunsuri Oracle midterm exam

    14/21

    4

    0. 5o need to dis+lay e!+loyees w#ose salary is in t#e range of 0BBBB and 7BBBB.;#ic# co!+arison o+erator s#old yo se/ Mark for Review

    (1) Points

    *. T#e EMP345EES table contains t#ese col!ns-

    EMP345EE*,

  • 7/27/2019 Raspunsuri Oracle midterm exam

    16/21

    2.

    SE3E"T de+art!entid ,EPT% lastna!e% firstna!e&R4M e!+loyees

    4R,ER =5 ,EPTI

    Cow will t#e reslts differ/

    Mark for Review

    (1) Points

    4ne of t#e state!ents will retrn a syntax error.

    4ne of t#e state!ents will eli!inate all d+licate ,EPRTME

  • 7/27/2019 Raspunsuri Oracle midterm exam

    17/21

    &R4M +layers

    ;CERE salary =ET;EE< 27BBB

  • 7/27/2019 Raspunsuri Oracle midterm exam

    18/21

    T#e order of o+erator +recedence is

  • 7/27/2019 Raspunsuri Oracle midterm exam

    19/21

    0RDER / (&

    W2ERE

    #R0M

    2A5'N3

    .orrect

    45.Eval"ate this %E$E.T state+ent6

    %E$E.T last4na+e7 first4na+e7 depart+ent4id7 +anager4id#R0M e+plo-ees8

    /o" need to sort data *- +anager id val"es and thenalpha*eticall- *- e+plo-ee last na+e and first na+e val"esWhich 0RDER / cla"se co"ld -o" "se?

    Mark for Review(1 !oints

    0RDER / depart+ent4id7 last4na+e

    0RDER / +anager4id7 last4na+e7 first4na+e (&

    0RDER / last4na+e7 first4na+e7 +anager4id

    0RDER / +anager4id7 first4na+e7 last4na+e

    .orrect

    46.Eval"ate this %E$E.T state+ent6

    %E$E.T R0M e+plo-eesW2ERE salar- 9 :;;;;

    AND depart+ent4id < 1;0R e+ail '% N0T NU$$8Which state+ent is tr"e?

    Mark for Review

    (1 !oints

    The 0R condition will *e eval"ated *efore the ANDconditionThe AND condition will *e eval"ated *efore the 0Rcondition (&The 0R and AND conditions have the sa+e precedenceand will *e eval"ated fro+ left to rightThe 0R and AND conditions have the sa+e precedenceand will *e eval"ated fro+ right to left

    .orrect

    47.Eval"ate this %E$E.T state+ent6

    %E$E.T R0M e+plo-eesW2ERE depart+ent4id < :=0R depart+ent4id < =>

    Mark for Review(1 !oints

  • 7/27/2019 Raspunsuri Oracle midterm exam

    20/21

    0R depart+ent4id < @8

    Which operator is the e"ivalent of the 0R conditions "sed inthis %E$E.T state+ent?

    'N (&

    AND

    $',E

    ETWEEN AND

    .orrect

    48./o" atte+pt to "er- the data*ase with this %B$ state+ent6

    %E$E.T prod"ct4id C!rod"ct N"+*erC7 categor-4idC.ategor-C7 price C!riceC

    #R0M prod"ctsW2ERE C.ategor-C < >>@;0RDER / C!rod"ct N"+*erC8

    This state+ent fails when eec"ted Which cla"se contains as-nta error?

    Mark for Review

    (1 !oints

    %E$E.T prod"ct4id C!rod"ct N"+*erC7 categor-4idC.ategor-C7 price CpriceC0RDER / C!rod"ct N"+*erC8

    #R0M prod"cts

    W2ERE C.ategor-C < >>@; (&

    .orrect

    49.Eval"ate this %E$E.T state+ent6

    %E$E.T e+plo-ee4id7 last4na+e7 first4na+e7 salar- /earl-%alar-#R0M e+plo-eesW2ERE salar- '% N0T NU$$0RDER / last4na+e7 :8

    Which cla"se contains an error?

    Mark for Review

    (1 !oints

    %E$E.T e+plo-ee4id7 last4na+e7 first4na+e7 salar-/earl- %alar- (R0M e+plo-ees

    W2ERE salar- '% N0T NU$$

    0RDER / last4na+e7 :8

    .orrect

  • 7/27/2019 Raspunsuri Oracle midterm exam

    21/21

    50./o" need to create a report to displa- all e+plo-ees thatwere hired on or after Fan"ar- 17 1GG The data sho"lddispla- in this for+at6

    E!+loyee Start ,ate and Salary

    1?0> 6 S!it# 1B6M56@2 7BBB

    Which %E$E.T state+ent co"ld -o" "se?

    Mark for Review(1 !oints

    %E$E.T e+plo-ee4id HH I HH last4na+e CE+plo-eeC7hire4date HH J HH salar- C%tart Date and %alar-C#R0M e+plo-eesW2ERE hire4date K< ;1IFANIG8%E$E.T e+plo-ee4id HH HH last4na+e CE+plo-eeC7hire4date HH HH salar- C%tart Date and %alar-C#R0M e+plo-eesW2ERE hire4date K< ;1IFANIG8%E$E.T e+plo-ee4id HHCI CHH last4na+e CE+plo-eeC7hire4date HHC J CHH salar- C%tart Date and %alar-C

    #R0M e+plo-eesW2ERE hire4date K< ;1IFANIG8%E$E.T e+plo-ee4id HH I HH last4na+e E+plo-ee7hire4date HH J HH salar- %tart Date and %alar-#R0M e+plo-eesW2ERE hire4date K< ;1IFANIG8%E$E.T e+plo-ee4id HH I HH last4na+e CE+plo-eeC7hire4date HH J HH salar- C%tart Date and %alar-C#R0M e+plo-eesW2ERE hire4date K< ;1IFANIG8

    (&

    .orrect