Unit 6 (Data Manipulation and Control II 1)

download Unit 6 (Data Manipulation and Control II 1)

of 23

Transcript of Unit 6 (Data Manipulation and Control II 1)

  • 8/12/2019 Unit 6 (Data Manipulation and Control II 1)

    1/23

    DATA MANIPULATION AND CONTROL - II

    1

  • 8/12/2019 Unit 6 (Data Manipulation and Control II 1)

    2/23

    DATA MANIPULATION AND CONTROL - II

    Objectives

    At the end of this unit, you will be able to

    Lea!n to "!eate #iews, inde$es and se%uen"es

    Topics

    C!eation of #iews

    Data Mani&ulation th!ou'h #iews

    C!eation of Inde$es

    C!eation of se%uen"es

    (

  • 8/12/2019 Unit 6 (Data Manipulation and Control II 1)

    3/23

    DATA MANIPULATION AND CONTROL - II

    Views

    O#e!#iew A #iew is a database ob)e"t that is a lo'i"al !e&!esentation of one

    o! *o!e tables+

    A #iew does not "ontain data+ Instead, a #iew is a #i!tual table,de!i#in' its data f!o* base tables+

    ou "an thin of #iew as a sto!ed %ue!y+

    The %ue!y &o!tion of the "!eate #iew state*ent, sele"ts "olu*ns

    and !ows f!o* s&e"ified tables usin' the standa!d sele"t synta$ butORD.R / "lause is not allowed+

    P!i#ile'es "an be '!anted on #iews+

    Ad#anta'es

    0e"u!ity Can li*it a""ess to s&e"ifi" table2s "olu*ns

    usin' a #iew and "!eate #alue based se"u!ity definin' a

    #iew fo! s&e"ifi" !ows+

    Con#enien"e 3iews "an !e&!esent !esults of *any

    diffe!ent tables+

    Pe!s&e"ti#e- 3iews "an hide data "o*&le$ity and &!esent

    data in anothe! way without affe"tin' basi" table definition

    Li*itations

    Use!s "annot inse!t, u&date o! delete !e"o!ds th!ou'h a #iew

    based on a 4ROUP / o&tion o! a 5OIN, sin"e it is not

    "lea! to the database se!#e! how to *a& a data *ani&ulation

    o&e!ation ba" to the unde!lyin' base table6s7 of a #iew+

    8

  • 8/12/2019 Unit 6 (Data Manipulation and Control II 1)

    4/23

    DATA MANIPULATION AND CONTROL - II

    Example 3iew e*&(9 "!eated f!o* .MP table+

    Table .MP

    .MPNO .NAM. 5O/ M4R :IR.DAT. 0AL COMM D.PTNO

    ;8 ;=9( 1;-D.C-=? @99 (9

    ;== A0:A 0AL.0MAN ;

  • 8/12/2019 Unit 6 (Data Manipulation and Control II 1)

    5/23

    DATA MANIPULATION AND CONTROL - II

    Create View

    Statement Create View

    Pu!&ose P!esent lo'i"al subsets o! "o*binations of data by "!eatin' #iewsof tables

    0ynta$

    Where

    OR R.PLAC. Re"!eates the #iew if it al!eady e$ists+

    BORC. C!eates the #iew !e'a!dless of whethe! the #iew2sbase tables e$ist o! the owne! of the #iew has

    &!i#ile'es on the base tables+

    NOBORC. C!eates the #iew only if the base tables e$ist and the

    owne! of the s"he*a "ontainin' the #iew has&!i#ile'es on the*

    s"he*a is the s"he*a to "ontain the #iew+ If youo*its"he*a, O!a"le "!eates the #iew in you! own

    s"he*a

    3iewna*e is the na*e of the #iew+Alias s&e"ifies the na*es fo! e$&!essions sele"ted

    Eue!y is a sele"t "lause

    ith C:.C> o&tion s&e"ifies that inse!ts and u&dates &e!fo!*ed th!ou'h

    the #iew "annot !esult in !ows that do not dis&lay

    th!o'h the #iew %ue!y

    Const!aintna*e is the na*e assi'ned to the C:.C> OPTION

    "onst!aint

    Note: hen the #iew is "!eated usin' BORC., 0.L.CT, IN0.RT,

    UPDAT. o! D.L.T. state*ents "an be issued a'ainst the #iewonly if the base table is in the sa*e s"he*a o! the owne! o! the

    #iew has &!i#ile'es on the table+

    ?

    CR.AT. FOR R.PLAC.G FBORC. H NOBORC.G 3I.

    Fs"he*a+G#iewna*eF6aliasF,aliasG7G

    A0 %ue!y

    IT: C:.C> OPTION FCON0TRAINT "onst!aintna*eG

  • 8/12/2019 Unit 6 (Data Manipulation and Control II 1)

    6/23

    DATA MANIPULATION AND CONTROL - II

    Example C!eate #iew "ontainin' e*&loyee nu*be!, na*e, )ob, de&a!t*entnu*be! fo! e*&loyees in de&a!t*ent (9

    SQL Command 0ELJ CR.AT. 3I. e*&(96ID,Na*e,Destination,De&a!t*ent7( A0 0.L.CT e*&no,ena*e,)ob,de&tno

    8 BROM e*&

    :.R. de&tnoK(9

    es!lt 3iew "!eated+

    Example To "onfi!* the "ontents of the #iew "!eated in the abo#e e$a*&le+

    SQL Command 0ELJ 0.L.CT BROM e*&(9

    es!lt ID NAM. D.0I4NATION D.PARTM.NT --------- ---------- -------------------- -------------------

    ;8 (9

    ;? (9

    ;=9( BORD ANAL0T (9

    ;8 (9 ;? (9 ;=9( BORD ANAL0T (9

    19 !ows sele"ted+

    Example U&datin' the #iew

    SQL Command 0ELJ UPDAT. e*&(9

    ( 0.T de&a!t*entK89

    8 :.R. idK1(8

    es!lt 1 !ow u&dated+

  • 8/12/2019 Unit 6 (Data Manipulation and Control II 1)

    7/23

    DATA MANIPULATION AND CONTROL - II

    Example To "onfi!* the "han'es to the #iew *ade by the abo#e e$a*&le+

    SQL Command 0ELJ 0.L.CT BROM e*&(9

    es!lt ID NAM. D.0I4NATION D.PARTM.NT

    --------- ---------- -------------------- --------------------

    ;8 (9 ;? (9

    ;=9( BORD ANAL0T (9 ;8 (9

    ;? (9 ;=9( BORD ANAL0T (9

    19 !ows sele"ted+

    To ensu!e that inse!ts and u&dates &e!fo!*ed th!ou'h #iew will not

    affe"t data that the #iew owns, "!eate the #iew with the IT:

    C:.C> OPTION "onst!aint+ The IT: C:.C> OPTION taes"a!e to see that the #alues to the "olu*n s&e"ified in this "lause is

    not inse!ted o! u&dated, in su"h a way that, it no lon'e! fo!*s &a!t

    on the #iew, i+e, it does not #iolate the #iew2s definition+

    Example C!eate #iew "ontainin' all "olu*ns f!o* e*& table fo! de&a!t*ent(9 IT: C:.C> o&tion+

    SQL Command 0ELJ CR.AT. 3I. e*&l(9

    ( A0 0.L.CT BROM e*&8 :.R. de&tnoK(9

    IT: C:.C> OPTION

    es!lt 3iew "!eated+

    ;

  • 8/12/2019 Unit 6 (Data Manipulation and Control II 1)

    8/23

    DATA MANIPULATION AND CONTROL - II

    Example To "onfi!* the "ontents of #iew e*&l(9+

    SQL Command 0ELJ 0.L.CT BROM e*&l(9

    es!lt

    .MPNO .NAM. 5O/ M4R :IR.DAT. 0AL COMM D.PTNO--------- ---------- --------- --------- --------------- --------- --------- ---------

    ;8 ;=9( 1;-D.C-@9

  • 8/12/2019 Unit 6 (Data Manipulation and Control II 1)

    9/23

    DATA MANIPULATION AND CONTROL - II

    Example To "!eate a #iew !e'a!dless of whethe! the #iew2s base tables e$isto! the owne! of the #iew has &!i#ile'es on the base tables+

    SQL Command 0ELJ CR.AT. BORC. 3I. #1( A0 0.L.CT $$,yy, f!o* $y

    es!lt a!nin' 3iew "!eated with "o*&ilation e!!o!s+

    Alter View

    Statement "LTE V#EW

    $!rpose To !e"o*&ile a #iew

    S%ntax

    Where

    COMPIL. "auses O!a"le to !e"o*&ile the #iew+

    Example Alte! the #iew e*&l(9+

    SQL Command 0ELJ ALT.R 3I. e*&l(9

    ( Co*&ile

    es!lt 3iew alte!ed+

    =

    ALT.R 3I. Fs"he*a+ G

    #iewna*e

  • 8/12/2019 Unit 6 (Data Manipulation and Control II 1)

    10/23

    DATA MANIPULATION AND CONTROL - II

    Drop View

    Statement &O$ V#EW

    $!rpose Re*o#e a #iew f!o* the database

    S%ntax

    Where

    #iewna*e is the na*e of the #iew+

    Example Delete the #iew e*&l(9 f!o* the database+

    SQL Command 0ELJ DROP 3I. e*&l(9

    es!lt 3iew d!o&&ed+

    19

    DROP 3I. #iewna*e

    COMPIL.

  • 8/12/2019 Unit 6 (Data Manipulation and Control II 1)

    11/23

    DATA MANIPULATION AND CONTROL - II

    Se'!ence

    A se%uen"e is a database ob)e"t f!o* whi"h use!s *ay 'ene!ate

    Uni%ue inte'e!s+ 0e%uen"es "an be used to auto*ati"ally 'ene!ateP!i*a!y ey #alues+

    Create Sequence

    Statement CE"TE SEQ(ENCE

    $!rpose 4ene!ate &!i*a!y ey #alues+

    S%ntax

    Where

    0e%uen"ena*e is na*e of the se%uen"e 'ene!ated+

    INCR.M.NT / s&e"ifies the inte!#al between se%uen"enu*be!s+ Default inte!#al #alue is 1+ Positi#e

    nu*be! as"ends the se%uen"e, ne'ati#e nu*be!

    des"ends the se%uen"e+ This nu*be! "annot be 9+

    0TART IT: s&e"ifies the fi!st se%uen"e nu*be! to be

    4ene!ated+ Default sta!t #alue is 1+

    11

    CR.AT. 0.EU.NC. se%uen"e na*e

    FINCR.M.NT by nG

    F0TART IT: nG

    FMA3ALU. n H NOMA3ALU.QG

    FMIN3ALU. n H NOMIN3ALU.G

    FCCL. n H NOCCL.QG

    FCAC:. n H NOCAC:.QG

  • 8/12/2019 Unit 6 (Data Manipulation and Control II 1)

    12/23

    DATA MANIPULATION AND CONTROL - II

    MA3ALU. s&e"ifies the *a$i*u* #alue the se%uen"e

    "an 'ene!ate

    NOMA3ALU. s&e"ifies the *a$i*u* #alue of 19 fo! a

    des"endin' se%uen"e+

    MIN3ALU. s&e"ifies the *ini*u* #alue the se%uen"e

    "an 'ene!ate

    NOMIN3ALU. s&e"ifies a *ini*u* #alue of 1 fo!

    as"endin' se%uen"e o! -19 fo!

    des"endin' se%uen"e+

    CCL. s&e"ifies that the se%uen"e "ontinues to 'ene!ate

    #alues afte! !ea"hin' its *in+ o! *a$ #alue+

    NOCCL. s&e"ifies that the #alues of the se%uen"e a!enot &!eallo"ated+

    CAC:. s&e"ifies how *any #alues the se!#e! will

    &!eallo"ate and ee& in a "o**on *e*o!y a!ea of

    the se!#e!, by default se!#e! will "a"he (9 #alues+

    NOCAC:. s&e"ifies that #alues of the se%uen"e a!e not

    &!eallo"ated+

    ORD.R 'ua!antees that se%uen"e nu*be!s a!e

    'ene!ated in o!de! of !e%uest+

    NOORD.R does not 'ua!antee se%uen"e nu*be!s a!e 'ene!atedin o!de! of !e%uest+

    Example C!eate a si*&le se%uen"e fo! de&t table+ 0ta!t with 89 and

    in"!e*ent by 19+

    SQLCommand 0ELJCR.AT. 0.EU.NC. sde&tno

    ( INCR.M.NT / 198 0TART IT: ?

    es!lt 0e%uen"e "!eated+

    1(

  • 8/12/2019 Unit 6 (Data Manipulation and Control II 1)

    13/23

    DATA MANIPULATION AND CONTROL - II

    Example C!eate a se%uen"e with sta!t #alue (?, in"!e*ent by 19, *a$i*u*

    #alue ??, and the se%uen"e "ontinues to 'ene!ate e#en afte! it has

    !ea"hed its *a$i*u* #alue+

    SQLCommand 0ELJD.0CRI/. use!se%uen"es

    es!lt

    Name N!ll T%pe------ ------ ------

    0.EU.NC.NAM. NOT NULL 3ARC:AR(6897

    MIN3ALU. NUM/.R

    MA3ALU. NUM/.R

    INCR.M.NT/ NOT NULL NUM/.R CCL.BLA4 3ARC:AR(617

    ORD.RBLA4 3ARC:AR(617

    CAC:.0IS. NOT NULL NUM/.R

    LA0TNUM/.R NOT NULL NUM/.R

    Example To #iew the "ontents of the use!se%uen"es table to "onfi!*, that

    the "!eated se%uen"e is a &a!t of the Data Di"tiona!y+

    SQLCommand 0ELJ0.L.CT se%uen"ena*e,*in#alue,*a$#alue,

    ( lastnu*be!,in"!e*entby

    8 BROM use!se%uen"es

    es!lt

    SEQ(ENCEN")E )#NV"L(E )"*V"L(E #NCE)ENT+, L"STN()+E

    ------------------------- ---------------- ------------------ ---------------------- ---------------------

    CU0TID 1 1+999.(; 1 =9=ORDID 1 1+999.(; 1

  • 8/12/2019 Unit 6 (Data Manipulation and Control II 1)

    14/23

    DATA MANIPULATION AND CONTROL - II

    AlterSequence

    Statement "LTE SEQ(ENCE

    $!rpose To "han'e the se%uen"e in one of these ways

    Chan'in' the in"!e*ent between futu!e se%uen"e #alues

    0ettin' o! eli*inatin' the *ini*u* o! *a$i*u* #alue

    Chan'in' the nu*be! of "a"hed se%uen"e nu*be!s

    0&e"ifyin' whethe! o! not se%uen"e nu*be!s *ust be o!de!ed+

    S%ntax

    Example Alte! the e$istin' se%uen"e s1 with in"!e*ent by 19, *a$i*u*

    3alue =9, *ini*u* #alue 19 and se%uen"e should "ontinue to'ene!ate e#en afte! it has !ea"hed its *a$i*u* #alue and ha#e a

    "a"he #alue of ?+

    SQLCommand 0ELJCR.AT. 0.EU.NC. s1

    ( INCR.M.NT / 19

    8 MA3ALU. =9 MIN3ALU. 19

    ? CCL. < CAC:. ?

    es!lt 0e%uen"e alte!ed+

    1

    ALT.R 0.EU.NC. se%uen"e na*e

    FINCR.M.NT by nG

    FMA3ALU. n H NOMA3ALU.QG

    FMIN3ALU. n H NOMIN3ALU.G

    FCCL. n H NOCCL.QG

    FCAC:. n H NOCAC:.QG

  • 8/12/2019 Unit 6 (Data Manipulation and Control II 1)

    15/23

    DATA MANIPULATION AND CONTROL - II

    Drop Sequence

    Statement &O$SEQ(ENCE

    $!rpose Re*o#e a se%uen"e f!o* the database+

    S%ntax

    Where

    0e%uen"ena*e is na*e of the se%uen"e+

    Example D!o& the se%uen"e "!eated fo! de&t table+

    SQLCommand 0ELJDROP 0.EU.NC. sde&tno

    es!lt 0e%uen"e d!o&&ed+

    1?

    DROP 0.EU.NC. se%uen"ena*e

  • 8/12/2019 Unit 6 (Data Manipulation and Control II 1)

    16/23

    DATA MANIPULATION AND CONTROL - II

    #ndexes

    Overview Inde$es a!e o&tional st!u"tu!es asso"iated with tables to s&eed

    %ue!y e$e"ution and o! 'ua!antee uni%ueness+

    A table "an ha#e any nu*be! of inde$es - i*&lied t!ade offis %ue!y

    s&eed #s+u&date s&eed+

    A *a$i*u* of 1< "olu*ns "an be in"luded in a sin'le inde$+

    Data a""ess in o!a"le is of th!ee ty&es

    /y OW#&-Di!e"t a""ess usin' !ow add!ess that indi"ates the

    e$a"t lo"ation of the data+

    Bull table s"an- 0e%uential sea!"h th!ou'h all of the !ows in the

    table+ /y inde$- /ina!y sea!"h usin' so!ted t!ee st!u"tu!e of "olu*n

    #alues+

    C!eate inde$ on a "olu*n if

    Colu*n is used f!e%uently in W-EE "lauses o! in a )oin

    "ondition+

    .#e!y #alue within the "olu*n is uni%ue+

    Colu*n "ontains a wide !an'e of #alues+

    Colu*n is s&a!sely &o&ulated, that is, it has a la!'e nu*be! of

    null #alues+ Table is la!'e and *ost %ue!ies a!e e$&e"ted to !et!ie#e fewe!

    than 19-1? of the !ows+

    Note O!a"le se!#e! will "hoose a data a""ess *ethod based u&on the

    e$istan"e of inde$es and the st!u"tu!e of the sele"t state*ent+

    1

  • 8/12/2019 Unit 6 (Data Manipulation and Control II 1)

    17/23

    DATA MANIPULATION AND CONTROL - II

    CREATE INDEX

    Statement CE"TE #N&E*

    $!rpose C!eate si*&le inde$es to i*&!o#e %ue!y &e!fo!*an"es on f!e%uently

    %ue!ied "olu*ns+ C!eate uni%ue inde$es to ensu!e that no two !ows will

    "ontain identi"al #alues in the !efe!en"es "olu*n6s7+

    S%ntax

    Where Inde$na*e is na*e of the inde$

    Tablena*e is na*e of the table

    Colu*nna*e is na*e of the "olu*n

    Example C!eate si*&le inde$ on "olu*n ena*e of table e*&+

    SQL Command 0ELJ CR.AT. IND. Iena*e

    ( On e*&6ena*e7

    es!lt Inde$ "!eated+

    Example C!eate uni%ue inde$ on "olu*n e*&no of table e*&+

    SQL Command 0ELJ CR.AT. UNIEU. IND. Ie*&noena*e

    ( ON e*&6e*&no,ena*e7

    es!lt Inde$ C!eated+

    Example . Confi!* the e$isten"e of inde$es f!o* the data di"tiona!y #iewU0.RIND..0

    SQL Command 0ELJ D.0CRI/. U0.RIND..0

    1;

    CR.AT. IND. H UNIEU. IND. inde$na*e

    ON tablena*e 6"olu*nna*e F,"olu*nna*eG+7

  • 8/12/2019 Unit 6 (Data Manipulation and Control II 1)

    18/23

    DATA MANIPULATION AND CONTROL - II

    es!lt Na*e Null Ty&e

    ----------------- -------- ---------IND.NAM. NOT NULL 3ARC:AR(6897

    IND.TP. 3ARC:AR(6(;7

    TA/L.ON.R NOT NULL 3ARC:AR(6897TA/L.NAM. NOT NULL 3ARC:AR(6897

    TA/L.TP. 3ARC:AR(6117

    UNIEU.N.00 3ARC:AR(6=7COMPR.00ION 3ARC:AR(6@7

    PR.BIL.N4T: NUM/.R

    TA/L.0PAC.NAM. 3ARC:AR(6897

    INITRAN0 NUM/.RMATRAN0 NUM/.R

    INITIAL.T.NT NUM/.R

    N.T.T.NT NUM/.R

    MIN.T.NT0 NUM/.RMA.T.NT0 NUM/.R

    PCTINCR.A0. NUM/.RPCTT:R.0:OLD NUM/.R

    INCLUD.COLUMN NUM/.R

    BR..LI0T0 NUM/.RBR..LI0T4ROUP0 NUM/.R

    PCTBR.. NUM/.R

    LO44IN4 3ARC:AR(687

    /L.3.L NUM/.RL.AB/LOC>0 NUM/.R

    DI0TINCT>.0 NUM/.R

    A34L.AB/LOC>0P.R>. NUM/.RA34DATA/LOC>0P.R>. NUM/.R

    CLU0T.RIN4BACTOR NUM/.R

    0TATU0 3ARC:AR(6@7NUMRO0 NUM/.R

    0AMPL.0IS. NUM/.R

    LA0TANALS.D DAT.

    D.4R.. 3ARC:AR(697IN0TANC.0 3ARC:AR(697

    PARTITION.D 3ARC:AR(687

    T.MPORAR 3ARC:AR(6174.N.RAT.D 3ARC:AR(617

    0.CONDAR 3ARC:AR(617

    /UBB.RPOOL 3ARC:AR(6;7U0.R0TAT0 3ARC:AR(687

    DURATION 3ARC:AR(61?7

    PCTDIR.CTACC.00 NUM/.R

    ITPON.R 3ARC:AR(6897ITPNAM. 3ARC:AR(6897

    1@

  • 8/12/2019 Unit 6 (Data Manipulation and Control II 1)

    19/23

    DATA MANIPULATION AND CONTROL - II

    PARAM.T.R0 3ARC:AR(619997

    4LO/AL0TAT0 3ARC:AR(687

    DOMID0TATU0 3ARC:AR(61(7DOMIDOP0TATU0 3ARC:AR(6

  • 8/12/2019 Unit 6 (Data Manipulation and Control II 1)

    20/23

    DATA MANIPULATION AND CONTROL - II

    S%non%ms

    O#e!#iew 0ynony*s "an be "!eated fo! !easons of se"u!ity and "on#enien"e+0ynony*s "an be eithe! &ubli" o! &!i#ate+

    Publi" A synony*n "!eated by D/A,a""essible to all use!s

    P!i#ate A synony* a""essible by the synony*2s "!eato!

    only

    Ad#anta'es

    To !efe!en"e Tables 3iew without s&e"ifyin' the owne! o!

    database Meanin'ful na*in' "on#entions

    O!a"le will use a synony* when !esol#in' !efe!en"es to a

    table#iew only when

    The table#iew is &!efa"ed by a use! na*e and

    The table#iew is not followed by a database lin

    Example Assu*e that U0.R1 has 'i#en '!ant &e!*ission on .MP table to

    U0.R(+ If U0.R( wants to %ue!y the .MP table the state*entwill be as follows

    0.L.CT BROM U0.R1+.MP

    Instead a synony* e*&l "an be "!eated fo! U0.R1+.MP+

    0o, any fu!the! !efe!en"es to table U0.R1+.MP "an be done withe*&l+

    Create Synonym

    Statement CE"TE S,NON,)

    $!rpose Alte!nate na*es fo! ob)e"ts, fo! "on#enien"e

    S%ntax

    (9

    CR.AT. FPU/LICG 0NONM synony*na*e

    BOR ob)e"tna*e

  • 8/12/2019 Unit 6 (Data Manipulation and Control II 1)

    21/23

    DATA MANIPULATION AND CONTROL - II

    Where

    PU/LIC C!eates a synony* a""essible to all use!s+

    Ob)e"tna*e identifies the ob)e"t fo! whi"h the synony*is "!eated+

    Example C!eate a synony* de&a!t fo! de&t+

    SQL Command 0ELJ CR.AT. 0NONM de&a!t

    ( BOR de&t

    es!lt 0ynony* "!eated+

    Drop Synonym

    Statement &O$ S,NON,)

    $!rpose D!o& synony* f!o* database

    S%ntax

    Where 0ynony*na*e is na*e of the synony*

    Example D!o& the synony* "!eated

    SQL Command 0ELJDROP 0NONM de&a!t

    es!lt 0ynony* d!o&&ed+

    (1

    DROP 0NONM synony*na*e

  • 8/12/2019 Unit 6 (Data Manipulation and Control II 1)

    22/23

    DATA MANIPULATION AND CONTROL - II

    RENAME

    Statement EN")E

    $!rpose Chan'es na*es of ob)e"ts in the "u!!ent s"he*a+ The ob)e"ts

    "an be tables, #iews,se%uen"es o! &!i#ate synony*s

    S%ntax

    WhereOldna*e is na*e of the ob)e"t whi"h has to be "han'ed

    Newna*e is na*e to be assi'ned to the ob)e"t

    Example Chan'e the na*e of the table e*& to newe*&

    SQL/Command 0ELJ R.NAM. e*& TO newe*&

    es!lt Table !ena*ed+

    ((

    R.NAM. oldna*e TO newna*e

  • 8/12/2019 Unit 6 (Data Manipulation and Control II 1)

    23/23

    DATA MANIPULATION AND CONTROL - II

    S())", :0

    A 3I. is a database ob)e"t that "ontains no data of its own

    Any "han'es to the table asso"iated with a 3I., will auto*ati"ally !efle"t in the

    3I.

    Mani&ulatin' tables th!ou'h a 3I. ha#e "e!tain !est!i"tions

    IT: C:.C> OPTION "lause alon' with CR.AT. 3I. "o**and allows

    inte'!ity "onst!aints and data #alidation "he"s to be enfo!"ed on data bein'

    IN0.RT.D o! UPDAT.D

    5oin #iew "n also be *odified but any UPDAT, IN0.RT o! D.L.T. state*ent on a

    )oin #iew "an *odify only one unde!lyin' base table

    Pe!fo!*an"e "an be i*&!o#ed by inde$in' o! "luste!in' the tables

    0e%uen"es a!e used to 'ene!ate uni%ue nu*be!s, in as"endin' o! des"endin' o!de!

    The &seudo-"olu*n N.T3AL is used to e$t!a"t su""essi#e se%uen" nu*be!s f!o* a

    s&e"ified se%uen"e CURR3AL is used to !efe! to a se%uen"e nu*be! that is the

    "u!!ent se%uen"e nu*be!

    0e%uen"es "an be alte!ed and d!o&&ed+