DATA MANIPULATION AND CONTROL - II

1

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

(

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. sele"ts "olu*ns and !ows f!o* s&e"ified tables usin' the standa!d sele"t synta$ but ORD.DATA MANIPULATION AND CONTROL .to the unde!lyin' base table6s7 of a #iew+ 8 . a #iew is a #i!tual table.R /. "lause is not allowed+ P!i#ile'es "an be '!anted on #iews+ Ad#anta'es • • • 0e"u!ity 1 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 1 3iews "an !e&!esent !esults of *any diffe!ent tables+ Pe!s&e"ti#e. sin"e it is not "lea! to the database se!#e! how to *a& a data *ani&ulation o&e!ation ba".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 /.ou "an thin.of #iew as a sto!ed %ue!y+ The %ue!y &o!tion of the "!eate #iew state*ent. o&tion o! a 5OIN. de!i#in' its data f!o* base tables+ .

<A5ITCL.R>.0T A ./-=? 9(-APR-=? (@-0.0MAN CL.R.@.C-=< 1..=99 .<=@ .?<<RA5AMANA4.R> M4R .DAT.? A(.@8= .?(1 ..0ID.<=@ .0MAN MANA4.R> 0AL.@( :IR.-NO3-=? 9@-0.MPNO.=8A .? 1@.?<< .=9( .R 0AL.@AA .C-=? (9-B.MP ..II Example Table .@( .0T CL..< .5O/.C e*&(9 .@.@@0 UNILANAL.MP table+ 5O/ CL.@8= .? (A?9 8999 ?999 ((?9 1199 1A(? 8999 1899 COMM 899 ?99 1A99 9 D.R>.@@ .@8= .=9( .-=? 9=-5UN-=? 9=-D. 1.-D.C-=? (8-5AN-=? 0AL @99 (A99 1@.<?A .MPNO .0MAN 0AL.? (=.<=@ .8<=0MIT:C L.0T PR.R> ANAL..C-=? 98-D.0MAN MANA4.?<< .P-=? 1(-5AN-=< 98-D.A== .R ANAL.@8= ./-=? ((-B.<=@ .DATA MANIPULATION AND CONTROL .PTN O (9 89 89 (9 89 89 19 (9 19 89 (9 89 (9 19 3I.<=@ .NAM. =9(ANILANAL.NT 0AL.?<< .0T.R MANA4.NAM.<=@ .@@ . 0MIT: A0:A CA0IM RA5A MARIA /ILL 0U5IT 0UNIL C:RI0 TINA A5IT 5AC> ANIL MILAN 3iew e*&(9 "!eated f!o* .R> CL.P-=? 91-MA.8<= .

C> OPTION FCON0TRAINT "onst!aintDna*eG Where OR R.aliasGI7G A0 %ue!y CIT: C:.DATA MANIPULATION AND CONTROL .RT. 0. s"he*a o*it 3iewDna*e Alias Eue!y s"he*a. O!a"le "!eates the #iew in you! own s"he*a is the na*e of the #iew+ s&e"ifies the na*es fo! e$&!essions sele"ted is a sele"t "lause Re"!eates the #iew if it al!eady e$ists+ C!eates the #iew !e'a!dless of whethe! the #iew2s base tables e$ist o! the owne! of the #iew has &!i#ile'es on the base tables+ 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* is the s"he*a to "ontain the #iew+ If you Cith C:. o! D.L.G 3I. H NOBORC.PLAC.L.PLAC.II Create View Statement Pu!&ose Create View P!esent lo'i"al subsets o! "o*binations of data by "!eatin' #iews of tables 0ynta$ CR. UPDAT.C> OPTION "onst!aint Note: Chen the #iew is "!eated usin' BORC. IN0.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!aintDna*e is the na*e assi'ned to the C:..T. NOBORC.AT.C Fs"he*a+G#iewDna*eF6aliasF.CT. BORC. FOR R.G FBORC. state*ents "an be issued a'ainst the #iew only 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+ ? .

CT M BROM e*&(9L ID NAM. idK1(8AL es!lt 1 !ow u&dated+ < .=9( BORD 19 !ows sele"ted+ D. --------. )ob.R.C e*&(96ID.=9( BORD .CT e*&no.R> MANA4.8<= 0MIT: .0 .Destination.0T CL.De&a!t*ent7 ( A0 0.R> ANAL.L. 3I.0T CL.8<= 0MIT: . e*&(9 ( 0.@@ 0COTT .de&tno 8 BROM e*& A C:.L.R> MANA4..)ob. de&tnoK(9L 3iew "!eated+ es!lt Example SQL Command es!lt To "onfi!* the "ontents of the #iew "!eated in the abo#e e$a*&le+ 0ELJ 0.?<< 5ON.Na*e.0T D.0 .II Example SQL Command C!eate #iew "ontainin' e*&loyee nu*be!.R ANAL.@.R ANAL.< ADAM0 .---------.@@ 0COTT .ena*e. na*e.PARTM.DATA MANIPULATION AND CONTROL .0T CL.R> ANAL.T de&a!t*entK89 8 C:.?<< 5ON.< ADAM0 .AT..NT ------------------(9 (9 (9 (9 (9 (9 (9 (9 (9 (9 Example SQL Command U&datin' the #iew 0ELJ UPDAT.@.R. de&a!t*ent nu*be! fo! e*&loyees in de&a!t*ent (9 0ELJ CR.0I4NATION -------------------CL.

8<= 0MIT: .=9( BORD 19 !ows sele"ted+ D.?<< 5ON.R ANAL.< ADAM0 .CT M BROM e*& 8 C:.CT M BROM e*&(9L ID NAM.R> MANA4.DATA MANIPULATION AND CONTROL .8<= 0MIT: .PARTM..---------.@.=9( BORD .0T D.@. 3I.C> OPTION ta-es "a!e to see that the #alues to the "olu*n s&e"ified in this "lause is not inse!ted o! u&dated.?<< 5ON.R> ANAL.C> OPTION "onst!aint+ The CIT: C:..R ANAL. --------.@@ 0COTT .R> MANA4.C e*&l(9 ( A0 0.@@ 0COTT . "!eate the #iew with the CIT: C:.R.AT.0T CL. it does not #iolate the #iew2s definition+ Example SQL Command C!eate #iew "ontainin' all "olu*ns f!o* e*& table fo! de&a!t*ent (9 CIT: C:.0 . it no lon'e! fo!*s &a!t on the #iew. i+e.0 .L. de&tnoK(9 A CIT: C:.II Example SQL Command es!lt To "onfi!* the "han'es to the #iew *ade by the abo#e e$a*&le+ 0ELJ 0.0I4NATION -------------------CL.NT -------------------(9 (9 (9 (9 (9 (9 (9 (9 (9 (9 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.0T CL.C> OPTIONL 3iew "!eated+ es!lt .C> o&tion+ 0ELJ CR. in su"h a way that.R> ANAL. .L.0T CL.< ADAM0 .

0T .0T .-D.R> .C> OPTION whe!e-"lause #iolation+ @ .DAT.L.?<< 5ON.=9( 1.?<< 98-D. 0AL --------.R> .C-@9 <8=9 .C-@1 18919 .R> .0 MANA4.C-@( .MPNO . 5O/ M4R :IR.=9( 1.=9( BORD ANAL..@8= 9(-APR-@1 @.@@ 1(-5AN-@8 .@@ 0COTT ANAL.@.=9( BORD ANAL.0 MANA4.R> ..NAM.?<< 98-D.PTNO --------(9 (9 (9 (9 (9 (9 (9 (9 (9 (9 Example SQL Command U&date e*&l(9 and t!y to "han'e the de&tno of one of the e*&loyees to 89 0ELJ UPDAT.C-@9 .< ADAM0 CL. e*&noK1(8?L es!lt Che!e e*&no K 1(8? M ..?<< 9=-D.@8= 9(-APR-@1 .DATA MANIPULATION AND CONTROL .-D.0T .8<= 0MIT: CL.@(+? .?<< 5ON.CT M BROM e*&l(9L .R ..C-@( @@19 .--------.T de&tnoK89 8 C:. e*&l(9 ( 0.@@ 0COTT ANAL.---------.(9 .R .R.8<= 0MIT: CL.@@ 1(-5AN-@8 <.?<< 9=-D.II Example SQL Command es!lt To "onfi!* the "ontents of #iew e*&l(9+ 0ELJ 0.--------------.0T .@.----------------.C-@1 19 !ows sele"ted+ COMM --------8999 8999 8999 8999 8999 8999 8999 8999 D.RROR at line 8 ORA-91A9( #iew CIT: C:.< ADAM0 CL.

DATA MANIPULATION AND CONTROL .II Example SQL Command es!lt To "!eate a #iew !e'a!dless of whethe! the #iew2s base tables e$ist o! the owne! of the #iew has &!i#ile'es on the base tables+ 0ELJ CR.yy.R 3I.L.R 3I.C #1 ( A0 0.NN f!o* $yNL Ca!nin' 3iew "!eated with "o*&ilation e!!o!s+ Alter View Statement $!rpose S%ntax "LTE V#EW To !e"o*&ile a #iew ALT.C e*&l(9 ( Co*&ileL 3iew alte!ed+ = . 3I.CT $$. BORC. "auses O!a"le to !e"o*&ile the #iew+ Example SQL Command es!lt Alte! the #iew e*&l(9+ 0ELJ ALT. Where COMPIL.AT.C Fs"he*a+ G #iewDna*e COMPIL.

DATA MANIPULATION AND CONTROL . Where #iewDna*e is the na*e of the #iew+ Example SQL Command es!lt Delete the #iew e*&l(9 f!o* the database+ 0ELJ DROP 3I.C e*&l(9 3iew d!o&&ed+ 19 .C #iewDna*e COMPIL.II Drop View Statement $!rpose S%ntax & O$ V#EW Re*o#e a #iew f!o* the database DROP 3I.

NT by nG F0TART CIT: nG FOMAP3ALU. is na*e of the se%uen"e 'ene!ated+ s&e"ifies the inte!#al between se%uen"e nu*be!s+ Default inte!#al #alue is 1+ Positi#e nu*be! as"ends the se%uen"e.RG Where 0e%uen"eDna*e INCR.NC. se%uen"eD na*e FINCR.R n H NOORD.DATA MANIPULATION AND CONTROL .AT.CL.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!ate P!i*a!y -ey #alues+ Create Sequence Statement $!rpose S%ntax C E"TE SEQ(ENCE 4ene!ate &!i*a!y -ey #alues+ CR. 0.QG FMIN3ALU. n H NOMAP3ALU.EU.NT /.CL.QG FOCAC:. ne'ati#e nu*be! des"ends the se%uen"e+ This nu*be! "annot be 9+ s&e"ifies the fi!st se%uen"e nu*be! to be 4ene!ated+ Default sta!t #alue is 1+ 0TART CIT: 11 . n H NOMIN3ALU. n H NOCAC:. n H NOC.G FOC.QG FORD.M.M.

EU. NOCAC:.NT /. NOC.R Example SQL Command C!eate a si*&le se%uen"e fo! de&t table+ 0ta!t with 89 and in"!e*ent by 19+ 0ELJCR.II MAP3ALU. CAC:.DATA MANIPULATION AND CONTROL . 19 8 0TART CIT: A?L 0e%uen"e "!eated+ es!lt 1( .M. s&e"ifies the *a$i*u* #alue the se%uen"e "an 'ene!ate s&e"ifies the *a$i*u* #alue of 19 fo! a des"endin' se%uen"e+ s&e"ifies the *ini*u* #alue the se%uen"e "an 'ene!ate s&e"ifies a *ini*u* #alue of 1 fo! as"endin' se%uen"e o! -19 fo! des"endin' se%uen"e+ s&e"ifies that the se%uen"e "ontinues to 'ene!ate #alues afte! !ea"hin' its *in+ o! *a$ #alue+ s&e"ifies that the #alues of the se%uen"e a!e not &!eallo"ated+ 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!. 0.CL. by default se!#e! will "a"he (9 #alues+ s&e"ifies that #alues of the se%uen"e a!e not &!eallo"ated+ 'ua!antees that se%uen"e nu*be!s a!e 'ene!ated in o!de! of !e%uest+ does not 'ua!antee se%uen"e nu*be!s a!e 'ene!ated in o!de! of !e%uest+ C.AT. ORD. NOMIN3ALU.CL. MIN3ALU. NOMAP3ALU. sDde&tno ( INCR.NC.R NOORD.

II Example C!eate a se%uen"e with sta!t #alue (?.DBLA4 ORD. in"!e*ent by 19. 1+999.DNAM.D0IS.CT se%uen"eDna*e.*inD#alue. LA0TDNUM/.NTD/.T(. ?? 1 1 1 19 19 =9= <(( (998@ A? (? 18 . 1+999. that the "!eated se%uen"e is a &a!t of the Data Di"tiona!y+ 0ELJ0. and the se%uen"e "ontinues to 'ene!ate e#en afte! it has !ea"hed its *a$i*u* #alue+ 0ELJD. INCR.T(.R SQL Command es!lt Name -----0.R 3ARC:AR(617 3ARC:AR(617 NUM/.R NUM/. use!Dse%uen"esL N!llR -----NOT NULL NOT NULL NOT NULL NOT NULL T%pe -----3ARC:AR(6897 NUM/. *a$i*u* #alue ??.R NUM/.T(.R NUM/. ( lastDnu*be!.NC.PTNO 01 ? Rows 0ele"ted 1 1 1 1 1 1+999.CL.M. MIND3ALU.EU.L.in"!e*entDby 8 BROM use!Dse%uen"esL es!lt SEQ(ENCEDN")E )#NDV"L(E )"*DV"L(E #NC E)ENTD+.R Example SQL Command To #iew the "ontents of the use!Dse%uen"es table to "onfi!*.DATA MANIPULATION AND CONTROL . L"STDN()+E ---------------------------------------. C. MAPD3ALU.T(. 1+999.0CRI/.RDBLA4 CAC:.*a$D#alue.--------------------- CU0TID ORDID PRODID 0DD.--------------------------------------.

M. =9 A MIN3ALU.R 0.II Alter Sequence Statement $!rpose "LTE SEQ(ENCE 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+ ALT.NT /.QG FMIN3ALU.RG S%ntax Example Alte! the e$istin' se%uen"e s1 with in"!e*ent by 19.EU.NT by nG FOMAP3ALU. ?L 0e%uen"e alte!ed+ SQL Command es!lt 1A . n H NOC.G FOC. < CAC:.QG FORD. *a$i*u* 3alue =9. s1 ( INCR.EU.R n H NOORD.NC. se%uen"eD na*e FINCR.QG FOCAC:.M. 19 8 MAP3ALU.CL.CL.CL. *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 ?+ 0ELJCR. n H NOCAC:. n H NOMAP3ALU.DATA MANIPULATION AND CONTROL .AT.NC. 0. n H NOMIN3ALU. 19 ? C.

EU. sDde&tnoL 0e%uen"e d!o&&ed+ 1? .NC.II Drop Sequence Statement $!rpose S%ntax Where 0e%uen"eDna*e is na*e of the se%uen"e+ & O$ SEQ(ENCE Re*o#e a se%uen"e f!o* the database+ DROP 0.EU. se%uen"eDna*e Example SQL Command es!lt D!o& the se%uen"e "!eated fo! de&t table+ 0ELJDROP 0.DATA MANIPULATION AND CONTROL .NC.

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 U o! 'ua!antee uni%ueness+ A table "an ha#e any nu*be! of inde$es . that is./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-E E "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.0e%uential sea!"h th!ou'h all of the !ows in the table+ • /y inde$.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. 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< .DATA MANIPULATION AND CONTROL .

IND.AT. SQL Command 1.RDIND. UNIEU."olu*nDna*eGI+7 S%ntax Where Inde$Dna*e TableDna*e Colu*nDna*e Example is na*e of the inde$ is na*e of the table is na*e of the "olu*n C!eate si*&le inde$ on "olu*n ena*e of table e*&+ 0ELJ CR. U0.P H UNIEU.RDIND. .ena*e7 Inde$ C!eated+ Confi!* the e$isten"e of inde$es f!o* the data di"tiona!y #iew U0.0CRI/. IND.P inde$Dna*e ON tableDna*e 6"olu*nDna*e F.0 0ELJ D.DATA MANIPULATION AND CONTROL .AT.II CREATE INDEX Statement $!rpose C E"TE #N&E* 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+ CR.0 SQL Command es!lt Example . IND.AT.P IDena*e ( On e*&6ena*e7L Inde$ "!eated+ SQL Command es!lt Example C!eate uni%ue inde$ on "olu*n e*&no of table e*&+ 0ELJ CR.P.P IDe*&noDena*e ( ON e*&6e*&no.P. IND.

NUM/.PDT.PT.ABD/LOC>0 NUM/..P.NT NUM/.DATA MANIPULATION AND CONTROL .R MIND..RD>.RAT.R BR.R LO44IN4 3ARC:AR(687 /L. 3ARC:AR(6117 UNIEU.II es!lt Na*e NullR Ty&e -----------------------.RDPOOL 3ARC:AR(6.RD0TAT0 3ARC:AR(687 DURATION 3ARC:AR(61?7 PCTDDIR.00 3ARC:AR(6=7 COMPR.PTD.D 3ARC:AR(687 T.N4T: NUM/. D.--------IND.R DI0TINCTD>.ABD/LOC>0DP.MPORAR.D DAT.DNAM.R 0AMPL.P..DOCN.R INITIALD. NUM/.7 TA/L.LI0TD4ROUP0 NUM/.RD>.R INCLUD. NOT NULL 3ARC:AR(6897 TA/L. 3ARC:AR(617 /UBB.BIPDL.00 NUM/.R PCTDT:R.R 3ARC:AR(6897 IT.R NOT NULL 3ARC:AR(6897 TA/L.R CLU0T.0PAC.R PCTDBR.DT.R MAPDTRAN0 NUM/.R PCTDINCR.D 3ARC:AR(617 0. 3ARC:AR(6(.PDOCN. NUM/.7 U0.0 NUM/.CONDAR.PT. NUM/..NT0 NUM/.R A34DDATAD/LOC>0DP.3.00ION 3ARC:AR(6@7 PR.RIN4DBACTOR NUM/.DNAM.R 0TATU0 3ARC:AR(6@7 NUMDROC0 NUM/...R BR. 3ARC:AR(6897 1@ .R IT.L NUM/.R L.R MAPD.N.N.R A34DL.PT. NUM/.R TA/L.NT0 NUM/.PDNAM. 3ARC:AR(6897 INIDTRAN0 NUM/.S. NOT NULL 3ARC:AR(6897 IND.PT.R LA0TDANAL.0:OLD NUM/.. 3ARC:AR(617 4. 3ARC:AR(6A97 IN0TANC.4R.0 3ARC:AR(6A97 PARTITION.D0IS.A0.CTDACC.NT NUM/.R N.LI0T0 NUM/.PDNAM.DCOLUMN NUM/.

tableDna*eK2.00 -------------------UNIEU.MP2L TA/L.DATA MANIPULATION AND CONTROL .tableDna*e.DNAM.PDNAM.P IDena*e Inde$ d!o&&ed+ 1= .NAM.N.L.NAM. ES(LT IND. -------------------ID.MPNOD.R.R0 4LO/ALD0TAT0 DOMIDPD0TATU0 DOMIDPDOP0TATU0 BUNCIDPD0TATU0 Example SQL Command 3ARC:AR(619997 3ARC:AR(687 3ARC:AR(61(7 3ARC:AR(6<7 3ARC:AR(6@7 Confi!* the e$isten"e of inde$ "!eated by the abo#e e$a*&les 0ELJ 0.II PARAM.uni%ueness f!o* ( use!Dinde$es C:.MP . NONUNIEU. ID.CT inde$Dna*e.T. --------------------. ( !ows sele"ted DROP INDEX Statement $!rpose S%ntax Where Inde$Dna*e Example SQL Command es!lt is the na*e of the inde$ & O$ #N&E* Re*o#e an inde$ f!o* the database DROP IND.P inde$Dna*e D!o& inde$ on "olu*n ena*e 0ELJ DROP IND.MP UNIEU.

) Alte!nate na*es fo! ob)e"ts.NON. any fu!the! !efe!en"es to table U0.R1+.L.R1+.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" P!i#ate A synony*n "!eated by D/A.NON.R( wants to %ue!y the .AT.R(+ If U0.MP "an be done with e*&l+ Create Synonym Statement $!rpose S%ntax C E"TE S.DATA MANIPULATION AND CONTROL .MPL Instead a synony* e*&l "an be "!eated fo! U0.MP+ 0o. FPU/LICG 0.MP table 1 the state*ent will be as follows 0.R1+.MP table to U0.a""essible to all use!s A synony* a""essible by the synony*2s "!eato! only Ad#anta'es • • To !efe!en"e TablesU 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 tableU#iew only when • • Example The tableU#iew is &!efa"ed by a use! na*e and The tableU#iew is not followed by a database lin- Assu*e that U0.M synony*Dna*e BOR ob)e"tDna*e (9 .CT M BROM U0.R1 has 'i#en '!ant &e!*ission on . fo! "on#enien"e CR.

) D!o& synony* f!o* database DROP 0.M de&a!t ( BOR de&tL 0ynony* "!eated+ Drop Synonym Statement $!rpose S%ntax Where 0ynony*Dna*e is na*e of the synony* & O$ S.DATA MANIPULATION AND CONTROL .NON.M de&a!tL 0ynony* d!o&&ed+ (1 .M synony*Dna*e Example SQL Command es!lt D!o& the synony* "!eated 0ELJDROP 0. 0.NON.NON.AT.II Where PU/LIC Ob)e"tDna*e C!eates a synony* a""essible to all use!s+ identifies the ob)e"t fo! whi"h the synony* is "!eated+ Example SQL Command es!lt C!eate a synony* de&a!t fo! de&t+ 0ELJ CR.NON.

DATA MANIPULATION AND CONTROL . e*& TO newDe*&L Table !ena*ed+ (( . #iews. oldDna*e TO newDna*e Where OldDna*e NewDna*e Example SQL/Command es!lt is na*e of the ob)e"t whi"h has to be "han'ed is na*e to be assi'ned to the ob)e"t Chan'e the na*e of the table e*& to newDe*& 0ELJ R.NAM.NAM.II RENAME Statement $!rpose S%ntax EN")E Chan'es na*es of ob)e"ts in the "u!!ent s"he*a+ The ob)e"ts "an be tables.se%uen"es o! &!i#ate synony*s R.

T. IN0. :0 • • • • A 3I.C.DATA MANIPULATION AND CONTROL .C> OPTION "lause alon' with CR.C is a database ob)e"t that "ontains no data of its own Any "han'es to the table asso"iated with a 3I.II S())" .C Mani&ulatin' tables th!ou'h a 3I.L. in as"endin' o! des"endin' o!de! The &seudo-"olu*n N.AT. 3I.RT o! D.D o! UPDAT.C ha#e "e!tain !est!i"tions CIT: C:.PT3AL 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+ • • • • • (8 .D 5oin #iew "n also be *odified but any UPDAT. will auto*ati"ally !efle"t in the 3I. 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.C "o**and allows inte'!ity "onst!aints and data #alidation "he"-s to be enfo!"ed on data bein' IN0.RT.