SQL set opetrators one marks dumps

Embed Size (px)

Citation preview

  • 8/12/2019 SQL set opetrators one marks dumps

    1/16

    SET OPERATIONS, PRIVILIGES AND GRANTS

    1. What type of join is needed hen yo! ish to in"#!de $os that do not ha%e &at"hin' %a#!es(a.E)!i*join+.Nat!$a# join".O!te$ join

    d.A## of the a+o%e.Ans: c

    . What type of join is needed hen yo! ish to $et!$n $os that do ha%e &at"hin' %a#!es(a.E)!i*join+.Nat!$a# join".O!te$ joind.A## of the a+o%e.

    Ans- d

    . Whi"h of the fo##oin' is one of the +asi" app$oa"hes fo$ joinin' ta+#es(a. S!+)!e$ies+.Nat!$a# join".O!te$ joind.A## of the a+o%e.

    Ans- d

    /. The fo##oin' S0L is hi"h type of join- SELET 2STO3ER4T. 2STO3ER4ID, ORDER4T.2STO3ER4ID, NA3E, ORDER4ID 5RO3 2STO3ER4T,ORDER4T W6ERE 2STO3ER4T.2STO3ER4ID 7 ORDER4T. 2STO3ER4IDa.E)!i*join+.Nat!$a# join".O!te$ join

    d.a$tesian join Ans- a

    8. 6o &any ta+#es &ay +e in"#!ded ith a join(a. One+. To". Th$eed. A## of the a+o%e

    Ans- d

    9. The fo##oin' S0L is hi"h type of join- SELET 2STO3ER4T. 2STO3ER4ID, ORDER4T.2STO3ER4ID, NA3E, ORDER4ID 5RO3 2STO3ER4T,ORDER4T :

    a. E)!i*join+.Nat!$a# join".O!te$ joind.a$tesian join

    Ans- d

    ;. E%a#!ate this S0L state&ent- SELET e.E3PLO

  • 8/12/2019 SQL set opetrators one marks dumps

    2/16

    =. 3a$> fo$ $e%ie. In hi"h "ase o!#d yo! !se a 52LL O2TER ?OIN(a. @oth ta+#es ha%e N2LL %a#!es.+.

  • 8/12/2019 SQL set opetrators one marks dumps

    3/16

    Vie Anse$

    Ans- "

    1/. The 4444444ope$ation pe$fo$&s a set !nion of to Fsi&i#a$#y st$!"t!$ed ta+#esa. 2nion

    +. ?oin". P$od!"td. Inte$se"t

    Ans- a

    18. The $es!#t hi"h ope$ation "ontains a## pai$s of t!p#es f$o& the to $e#ations, $e'a$d#ess ofhethe$ thei$ att$i+!te %a#!es &at"ha. ?oin+. a$tesian p$od!"t". Inte$se"tiond. Set diffe$en"e

    Ans- +

    19. The44444 ope$ation a##os the "o&+inin' of to $e#ations +y &e$'in' pai$s of t!p#es, one f$o&ea"h $e#ation, into a sin'#e t!p#e.a. Se#e"t+. ?oin". 2niond. Inte$se"tion

    Ans- +

    1;. An 4444 )!e$y "an +e !sed to p$od!"e a $e#ation that $etains d!p#i"ate $os.

    a. 2NION

    +.2NION ALL".INTERSETd.3IN2S

    Ans- +

    1=. A 4444 is a )!e$y inside a )!e$y.a.s!+)!e$y+.+ase)!e$y".joind.set )!e$y

    Ans- a

    1. INSERT INTO PROD2T SELET H 5RO3 P: is an eCa&p#e of a 4444.a. join+.s!+)!e$y". set ope$ato$d.sto$ed p$o"ed!$e

    Ans- +

    B. An 4444 is a +#o"> of "ode "ontainin' standa$d S0L state&ents and p$o"ed!$a# eCtensionsthat is sto$ed and eCe"!ted at the D@3S se$%e$.

    a.pe$sistent sto$ed &od!#e+.pe$&anent S0L &od!#e".S0L state&ent

  • 8/12/2019 SQL set opetrators one marks dumps

    4/16

    d.p$o'$a& &anip!#ation "o&&and

    Ans- a

    1. An 4444 join $et!$ns not on#y the $os &at"hin' the join "ondition +!t a#so the $os ith!n&at"hed %a#!es.

    a.o!te$+.inne$".e)!i*d."$oss

    Ans- a

    .An 4444 join i## se#e"t on#y the $os ith "o&&on %a#!es in the "o&&on "o#!&ns,eC"#!din' $os ith !n&at"hed %a#!es and d!p#i"ate "o#!&ns.

    a.nat!$a#+."$oss

    ".f!##d.o!te$

    Ans- a

    . The 4444 pse!do "o#!&n is !sed to se#e"t the neCt a%ai#a+#e %a#!e f$o& a se)!en"e.

    a.2RRVAL+.NETVAL".NETd.GET4NET

    Ans- a

    /. What type of inne$ join $e)!i$es the !se of a ta+#e )!a#ifie$(

    a.2SING+.NAT2RAL".E02I*d.?OIN ON

    Ans- a

    8. The fo##oin' S0L state&ent !ses an 4444. SELET P4ODE, P4DESRIPT, P4PRIE,V4NA3E 5RO3 PROD2T, VENDOR W6ERE PROD2T.V4ODE 7 VENDOR.V4ODE:

    a.set ope$ato$+.nat!$a# join".Jo#d*sty#eJ joind.p$o"ed!$a# state&ent

    Ans- "

    9. What type of s!+)!e$y "o!#d +e !sed in p#a"e of INTERSET if the RD@3S does not s!ppo$tit(

    a.IN+.5".AND

  • 8/12/2019 SQL set opetrators one marks dumps

    5/16

    d.2NION

    Ans- a

    ;. o&p#ete the fo##oin' inne$ join- SELET H 5RO3 T1 ?OIN T 4444 1

    a. O5

    +. 2SING" 6ASd. ?OIN ON

    Ans- +

    =. What type of s!+)!e$y "o!#d +e !sed in p#a"e of 3IN2S if the RD@3S does not s!ppo$t it(

    a.IN+.NOT IN".ANDd.2NION

    Ans- +

    . If yo! ish to "$eate an inne$ join +!t the to ta+#es do not ha%e a "o&&on#y na&ed att$i+!te,yo! "an !se an 4444 "#a!se.

    a.O5+.2SING".6ASd.?OIN ON

    Ans- +

    B. Ass!&e yo! a$e !sin' the 2NION ALL state&ent to "o&+ine the $es!#ts f$o& to identi"a#ta+#es 2STO3ER and 2STO3ER4. The 2STO3ER ta+#e "ontains 1B $os, hi#e the2STO3ER4 ta+#e "ontains se%en $os. The$e a$e to "!sto&e$s in"#!ded in +oth ta+#es. 6o&any $e"o$ds a$e $et!$ned hen !sin' the 2NION ALL state&ent(

    a.;+.1B".18d.1;

    Ans- d

    1. Ass!&e yo! a$e !sin' the 2NION state&ent to "o&+ine the $es!#ts f$o& to identi"a# ta+#es2STO3ER and 2STO3ER4. The 2STO3ER ta+#e "ontains 1B $os, hi#e the2STO3ER4 ta+#e "ontains se%en $os. The$e a$e to "!sto&e$s in"#!ded in +oth ta+#es. 6o&any $e"o$ds a$e $et!$ned hen !sin' the 2NION state&ent(

    a.;+.1B".18d.1;

    Ans- "

    . 6o sho!#d a &any*to*&any $e#ationship +e hand#ed(a.@y addin' an join entity ta+#e

  • 8/12/2019 SQL set opetrators one marks dumps

    6/16

    +. @y addin' inte$se"tion entity ta+#e". @y addin' !nion entity ta+#ed. @y addin' a$tesian entity ta+#e

    Ans- +

    3. A 2NION )!e$y is hi"h of the fo##oin'(a. o&+ines the o!tp!t f$o& no &o$e than to )!e$ies and &!st in"#!de the sa&e n!&+e$ of

    "o#!&ns.+. o&+ines the o!tp!t f$o& no &o$e than to )!e$ies and does not in"#!de the sa&e n!&+e$ of"o#!&ns.". o&+ines the o!tp!t f$o& &!#tip#e )!e$ies and &!st in"#!de the sa&e n!&+e$ of "o#!&ns.d. o&+ines the o!tp!t f$o& &!#tip#e )!e$ies and does not in"#!de the sa&e n!&+e$ of "o#!&ns.

    Ans- "

    3/. O!t of the +e#o data types hi"h "an +e !sed fo$ date and ti&e typea. Date+. Date and Ti&e offset". Ti&ed. A##

    Ans-d

    8. What is the ISO synony& fo$ neCt date type.a. Ne TeCt+. NeCt teCt". Nationa# teCtd. None of the a+o%e.

    Ans- "

    9. The S0L )!e$y to $et$ie%e "!$$ent ti&e in O$a"#e isa.Se#e"t SysTi&e f$o& d!a#

    +.Se#e"t SysDate f$o& d!a#". Se#e"t TO46AR SysDate,K66-3I-SSK f$o& d!a#d. Se#e"t TO46AR SysDate,K66-33-SSK f$o& d!a#e. @oth " and d

    Ans- "

    ;. Re'!#a$ sets a$e "#osed !nde$ !nion,"on"atenation and >#eene "#os!$e.a. T$!e+. 5a#se". Depends on $e'!#a$ setd. anKt say

    Ans- a

    =.If L1 and L a$e $e'!#a$ sets then inte$se"tion of these to i## +ea. Re'!#a$+. Non Re'!#a$". Re"!$si%ed. Non Re"!$si%e

    Ans- a

    . The join >eyo$d is in"#!ded in hi"h of the fo##oin' "#a!ses(a.SELET+.W6ERE".5RO3

    D.ORDER @non as ana. ine)!a#ity join+. e)!a#ity join". o!te$ joind. a## of the a+o%e

    Ans- +

    //. Whi"h of the fo##oin' >eyo$d is !sed to "$eate a e)!a#ity join(

    a. Nat!$a# join+. join..!sin'". join..ond. a## of the a+o%e

    Ans- d

    /8. Whi"h of the fo##oin' >eyo$d is !sed to join to ta+#es that do not "ontained a "o&&onna&ed and defined "o#!&n(a. Nat!$a# join+. join..!sin'". join..ond. a## of the a+o%e

    Ans- "

    /9. A ta+#e a#ias "annot +e assi'hned in the 5RO3 "#a!se if hi"h of the fo##oin' >eyo$ds is!sed to join ta+#esa. Nat!$a# join+. join..!sin'". join..ond. a## of the a+o%e

    Ans- a

    /;. If yo! a$e atte&ptin' to join to ta+#es that ha%e &!#tip#e "o&&on "o#!&ns hi"h of thefo##oin' ?OIN >eyo$d sho!#d +e !sed to spe"ify ho the ta+#es sho!#d +e #in>ed(

    a. Nat!$a# join+. join..!sin'". join..on

  • 8/12/2019 SQL set opetrators one marks dumps

    8/16

    d. a## of the a+o%eAns- +

    /=. Whi"h of the fo##oin' "an on#y !sed to #in> ta+#es that ha%e a "o&&on "o#!&n(a. Nat!$a# join+. join..!sin'". join..on

    d. a## of the a+o%eAns- a

    /. The o!te$ join ope$ato$ in the W6ERE "#a!se "annot +e !sed ith hi"h of the fo##oon'ope$ato$s(a. IN+. AND". ORd. +oth a and "

    Ans- d

    8B. An ***** is !sed to "o&+ine the $es!#ts of to )!e$iesa."on"atenation ope$ato$+."o&pa$ision ope$ato$". set ope$ato$d. #o'i"a# ope$ato$

    Ans- "

    81. Whi"h of the fo##oin' set ope$ato$s "an +e !sed to &a>e "e$tain the on#y the $os $et!$ned +y+oth )!e$ies a$e disp#ayed in the $es!#ts(a. 2NION+. INTERSET". 3IN2S

    d. 2NION ALL Ans- +

    8. Whi"h of the fo##oin' set ope$ato$s i## disp#ay the $es!#ts of the "o&+ined S0L state&entsitho!t s!pp$essin' d!p#i"ate $os(a. 2NION+. INTERSET". 3IN2Sd. 2NION ALL

    Ans- d

    8. Whi"h of the fo##oin' set ope$ato$s i## disp#ay on#y the !ni)!e $es!#ts of the "o&+ined S0L

    state&ents(a. 2NION+. INTERSET". 3IN2Sd. 2NION ALL

    Ans- a

    8/. Whi"h of the fo##oin' )!e$ies i## disp#ay data f$o& +oth the ORDRES and 2STO3ERSta+#es(a. se#e"t H f$o& o$de$s, "!sto&e$s+. se#e"t #astna&e, fi$stna&e, o$de$M f$o& o$de$s NAT2RAL ?OIN "!sto&e$s". se#e"t #astna&e, fi$stna&e, o$de$M f$o& o$de$s ,"!sto&e$s he$e

    o$de$s."!sto&e$M7"!sto&e$s."!sto&e$Md. A## of the a+o%e.

  • 8/12/2019 SQL set opetrators one marks dumps

    9/16

    89. Whi"h data type is !sed to a##os the ti&e to +e sto$ed as a date ith f$a"tiona# se"onds(a. TI3ESTA3P+. DATESTA3P". DATETI3Ed. TI3EINTERVAL

    Ans- a

    8;. Whi"h data type a##os ti&e to +e sto$ed as an inte$%a# of yea$s and &onths.a. INTERVAL

  • 8/12/2019 SQL set opetrators one marks dumps

    10/16

    9/. The ti&e one disp#a"e&ent is not sto$ed as pa$t of the "o#!&n data: O$a"#e $et!$ns the data inthe !se$s****a. data+ase ti&e one+. #o"a# session ti&e one". syste& ti&e oned. A## of the a+o%e

    Ans- +

    98. 2se the **** option to &a$> one o$ &o$e "o#!&ns a$e !n!sed.a. SET 2N2SED+. DROP 2N2SED". @oth a and +d. none of the a+o%e

    Ans- a

    99. 2se the ***** option to $e&o%e the "o#!&ns that a$e &a$>ed as !n!sed.a. SET 2N2SED+. DROP 2N2SED". @oth a and +d. none of the a+o%e

    Ans- +

    9;. We "annot $o## +a"> $o $e&o%a# hen !sin' *****a. TR2NATE+. DELETE". DROPd. None of the a+o%e

    Ans- a

    9=. Whi"h is !sed to $e#ease the sto$a'e spa"e !sed +y the ta+#es*)!e$yin'

    a. TR2NATE+. DELETE". DROPd. None of the a+o%e

    Ans- a

    9. Whi"h state&ent $e&o%es the definition of an O$a"#e ta+#e.a. DROP TA@LE+. DELETE TA@LE". TR2NATE TA@LEd. A## of the a+o%e

    Ans- a

    ;B. hi"h state&ent is !sed to $e&o%es the $os and ta+#e st$!"t!$e(a. DELETE TA@LE+. DROP TA@LE". TR2NATE TA@LEd. A## of the a+o%e

    Ans- +

    ;1. .1=. What TR2NATE and DELETE "o&&ands doesA.To $et$ie%e $os in a ta+#[email protected] $e&o%e so&e pa$t of a ta+#e.To 'et $id of a## $os in a ta+#e.

    D.To $e"o%e$ a## the $os de#eted in a ta+#e.Ans-

  • 8/12/2019 SQL set opetrators one marks dumps

    11/16

    ;. Ta+#es in $e"y"#e +in "an +e $eso#%ed +a"> into data+ase +y !sin'.A. 5#ash+a">@. 5#ash+a"> D$op. Re%o>eD. Re%o>e4Ta+#e

    Ans- +

    ;. P$i%i#e'es a$e assi'ned to !se$s th$o!'h 44444444444444.a. D@A+. Ro#e". Ta+#ed. Di"tiona$y

    Ans- +

    ;/. What S

  • 8/12/2019 SQL set opetrators one marks dumps

    12/16

    A. DROP e&p4dept4%!:@. DELETE e&p4dept4%!:. RE3OVE e&p4dept4%!:D. DROP VIEW e&p4dept4%!:

    Ans- d

    =/. When sho!#d yo! "$eate a $o#e(

    a. to si&p#ify the p$o"ess of "$eatin' ne !se$s !sin' the REATE 2SER CCC IDENTI5IED +y yyyystate&ent+. to '$ant a '$o!p of $e#ated p$i%i#e'es to a !se$". When the n!&+e$ of peop#e !sin' the data+ase is %e$y hi'hd. to si&p#ify the p$o"ess of '$antin' and $e%o>in' p$i%i#e'ese. To si&p#ify p$ofi#e &aintenan"e fo$ a !se$ ho is "onstant#y t$a%e#in'.

    Ans- +,d

    =8. Whi"h data di"tiona$y ta+#e sho!#d yo! )!e$y to %ie the o+je"t p$i%i#e'es '$anted to the !se$on spe"ifi" "o#!&ns( U O$a"#ea. 2SER4TA@4PRIVS43ADE@. 2SER4TA@4PRIVS. 2SER4OL4PRIVS43ADED. 2SER4OL4PRIVS

    Ans- d

    =9.

  • 8/12/2019 SQL set opetrators one marks dumps

    13/16

    +. DELETE, INSERT, SELET". ALTER, DELETE, INSERT, SELETd. DELETE, INSERT, SELET, 2PDATE

    Ans- d

    =. What is t$!e a+o!t the WIT6 GRANT OPTION "#a!se(a. It a##os a '$antee D@A p$i%i#e'es+. It is $e)!i$ed syntaC fo$ o+je"t p$i%i#e'es". It a##os p$i%i#e'es on spe"ified "o#!&ns of ta+#esd. It is !sed to '$ant an o+je"t p$i%i#e'e on a fo$ei'n >ey "o#!&ne. It a##os the '$antee to '$ant o+je"t p$i%i#e'es to othe$ !se$s and $o#es

    Ans- e

    B. 3a$> fo$ $e%ie The D@A iss!es this S0L "o&&and- REATE 2SER S"ott IDENTI5IED +yti'e$: hat p$i%i#e'es do the !se$ S"ott has at this point(

    a. no p$i%i#e'es+. on#y the SELET p$i%i#e'e". on#y the ONNET p$i%i#e'ed. a## the p$i%i#e'es of a defa!#t !se$

    Ans- a

    1. 3a$> fo$ $e%ie ECa&ine these state&ents- REATE ROLE $e'ist$a$: GRANT 2PDATE ONst!dent4'$ades TO $e'ist$a$: GRANT $e'ist$a$ to !se$1, !se$, !se$: What does this set of S0Lstate&ents do(

    a. The set of state&ents "ontains an e$$o$ and does not o$>.+. It "$eates a $o#e "a##ed REGISTRAR, adds the 3ODI5< p$i%i#e'e on the ST2DENT4GRADESo+je"t to the $o#e, and 'i%es the REGISTRAR $o#e to th$ee !se$s.". It "$eates a $o#e "a##ed REGISTRAR, adds the 2PDATE p$i%i#e'e on the ST2DENT4GRADESo+je"t to the $o#e, and 'i%es the REGISTRAR $o#e to th$ee !se$s.d. It "$eates a $o#e "a##ed REGISTRAR, adds the 2PDATE p$i%i#e'e on the ST2DENT4GRADESo+je"t to the $o#e, and "$eates th$ee !se$s ith the $o#e.

    Ans- "

    . S"ott iss!es the S0L state&ents- REATE TA@LE dept deptno n!&+e$ dna&eVAR6AR 1/ #o" VAR6AR 1: GRANT SELET ON DEPT TO S2E: If S!e needs to

    se#e"t f$o& S"ottKs DEPT ta+#e, hi"h "o&&and sho!#d she !se(a. SELET H 5RO3 DEPT+. SELET H 5RO3 SOTT.DEPT". SELET H 5RO3 [email protected]. SELET H 5RO3 ALL42SERS W6ERE 2SER4NA3E 7 SOTTK AND TA@LE NA3E7 DEPTK:

    Ans- +

    . 3a$> fo$ $e%ie. The !se$ A#i"e ants to '$ant a## !se$s )!e$y p$i%i#e'es on he$ DEPT ta+#e.Whi"h S0L state&ent a""o&p#ishes this(

    a. GRANT se#e"t ON dept TO ALL42SERS:

    +. GRANT se#e"t ON dept TO ALL:". GRANT 02ER< ON dept TO ALL42SERSd. GRANT se#e"t ON dept TO P2@LI:

  • 8/12/2019 SQL set opetrators one marks dumps

    14/16

    Ans- d

    /. the p$i%i#e'es offe$ed +y the GRANT "o&&and(

  • 8/12/2019 SQL set opetrators one marks dumps

    15/16

    a. Inse$t

    +. De#ete

    ". T$!n"ate

    d. REVOE

    Ans- d

    = .Whi"h syste& ta+#es "ontain info$&ation on p$i%i#e'es '$anted and p$i%i#e'es o+tained(

    a. 2SER4TA@4PRIVS43ADE, 2SER4TA@4PRIVS4RED.

    +. 2SER4TA@4PRIVS43ADE, 2SER4TA@4GRANT4RED.

    ". 2SER4TA@4REVO43ADE, 2SER4TA@4PRIVS4RED.

    d. 2SER4TA@4PRIVS43ADE, 2SER4TA@4REVO4RED.

    Ans- a

    . It is %e$y diffi"!#t to '$ant and &ana'e "o&&on p$i%i#e'es needed +y diffe$ent '$o!ps ofdata+ase !se$s !sin' the $o#esa. T$!e

    +. 5a#se

    Ans - 5a#se

    1BB. The******* state&ent is $e#ated to GRANTand ena+#es ad&inist$ato$s to $e&o%e a""o!ntp$i%i#e'es.

    a. REVOE

    +.ROLE

    ".INSERT

    d. SELET

    Ans- a

    1B1. The $e#ationship +eteen the entities in%o#%ed in !se$ &ana'e&ent "an +e(More than one answer is correct)a. A $o#e is !sed to '$ant a!tho$iation to "a$$y o!t ope$ations on data+ase o+je"ts, s!"has s"he&as, ta+#es, and %ies.

    +. A p$in"ipa# is eithe$ a $o#e o$ a !se$.". A >non !se$ "an #o' on to the data+ase. A !se$ "an +e the one$ of data+ase o+je"ts.d. A $o#e is a "o##e"tion of p$i%i#e'es and "an +e '$anted to eithe$ a !se$ o$ anothe$ $o#enestin'.

    Ans- +, ", d

    1B. An o+je"t "an on#y +e a""essed +y the fo##oin' !se$s-(More than one answer is correct)a. 2se$s to ho& the one$ of the pa$ent s"he&a has '$anted p$i%i#e'es

    +. The one$ of the s"he&a in hi"h the o+je"t is #o"ated". 2se$s to ho& the one$ of the o+je"t has '$anted p$i%i#e'es

    Ans- a, +, "

    http://dev.mysql.com/doc/refman/5.1/en/grant.htmlhttp://dev.mysql.com/doc/refman/5.1/en/grant.html
  • 8/12/2019 SQL set opetrators one marks dumps

    16/16

    1B. SAP 6ANA offe$s diffe$ent types of p$i%i#e'es. Whi"h if the fo##oin' is NOT a p$i%i#e'e offe$ed+y SAP 6ANA.a. Syste& p$i%i#e'e+. O+je"t p$i%i#e'e". Data+ase p$i%i#e'ed. Ana#yti" p$i%i#e'e

    Ans- "1B/. What a$e %a$io!s p$i%i#e'es that a !se$ "an '$ant to anothe$ !se$(a. SELET+. ONNET". RESO2RES

    Ans- a,+,"

    1B8.TR2NATE TA@LE state&ent

    a. D$ops a ta+#e te&po$a$i#y+. Re&o%es a## $os of a ta+#e". Re&o%es spe"ified n!&+e$ of $os f$o& a ta+#e

    d. Re&o%es a## "onst$aints f$o& a ta+#eAns- +

    1B9. P$i%i#e'es a$e assi'ned to !se$s th$o!'h 44444444444444.a. D@A

    +. Ro#e". Ta+#ed. Di"tiona$y

    Ans- +

    1B;. The S0L )!e$y to $et$ie%e "!$$ent ti&e in O$a"#e isa. Se#e"t SysTi&e f$o& d!a#+. Se#e"t SysDate f$o& d!a#". Se#e"t TO46AR SysDate,K66-3I-SSK f$o& d!a#d. Se#e"t TO46AR SysDate,K66-33-SSK f$o& d!a#e. @oth " and d

    Ans- "