Vous êtes sur la page 1sur 8

1.What are the types of SQL Statement?

Data Definition Language:

Data (anipu)ation Language: &#SERT,"!DATE,DELETE,LC% TA*LE,E+!LA&#
Transa,tiona) Contro): C((&T ' RLL*AC%
Session Contro) : ALTERSESS&# ' SET RLE
System Contro) : ALTER S-STE(.
..What is a transa,tion?Transa,tion is )ogi,a) unit /et0een t0o ,ommits an1 ,ommit an1
3.What is 1ifferen,e /et0een TR"#CATE ' DELETE?TR"#CATE ,ommits after
1e)eting entire ta/)e i.e., ,an not /e ro))e1 /a,2.
Data/ase triggers 1o not fire on TR"#CATE
DELETE a))o0s the fi)tere1 1e)etion. De)ete1 re,or1s ,an /e ro))e1 /a,2 or ,ommitte1.
Data/ase triggers fire on DELETE.
4.What is a 5oin? E6p)ain the 1ifferent types of 5oins?7oin is a 8uery 0hi,h retrie9es
re)ate1 ,o)umns or ro0s from mu)tip)e ta/)es.
Se)f 7oin : 7oining the ta/)e 0ith itse)f.
E8ui 7oin : 7oining t0o ta/)es /y e8uating t0o ,ommon ,o)umns.
#on:E8ui 7oin : 7oining t0o ta/)es /y e8uating t0o ,ommon ,o)umns.
uter 7oin : 7oining t0o ta/)es in su,h a 0ay that 8uery ,an a)so retri9e ro0s that 1o not
ha9e ,orrespon1ing 5oin 9a)ue in the other ta/)e.
;.What is the Su/8uery?Su/8uery is a 8uery 0hose return 9a)ues are use1 in fi)tering
,on1itions of the main 8uery.
<.What is ,orre)ate1 su/:8uery?Corre)ate1 su/=8uery is a su/=8uery 0hi,h has referen,e
to the main 8uery.
>.E6p)ain Conne,t /y !rior?Retri9es ro0s in hierar,hi,a) or1er.
e.g. se)e,t empno, ename from emp 0here.
?.Differen,e /et0een S"*STR an1 &#STR?&#STR @String1,String.@n,@mAA,
&#STR returns the position of the mth o,,urren,e of the string . in string1. The sear,h
/egins from nth position of string1.
S"*STR @String1 n,mA
S"*STR returns a ,hara,ter string of siBe m in string1, starting from nth postion of
C.E6p)ain "#&#, (&#"S, "#&# ALL, &#TERSECT?&#TERSECT returns a))
1istin,t ro0s se)e,te1 /y /oth 8ueries.
(&#"S : returns a)) 1istin,t ro0s se)e,te1 /y the first 8uery /ut not /y the se,on1.
"#&# : returns a)) 1istin,t ro0s se)e,te1 /y either 8uery
"#&# ALL : returns a)) ro0s se)e,te1 /y either 8uery,in,)u1ing a)) 1up)i,ates.
1D.What is RW&D? RW&D is a pseu1o ,o)umn atta,he1 to ea,h ro0 of a ta/)e. &t is 1?
,hara,ter )ong, /)o,2no, ro0num/er are the ,omponents of RW&D.
11.What is the fastest 0ay of a,,essing a ro0 in a ta/)e? "sing RW&D.
1..What is an &ntegrity Constraint? &ntegrity ,onstraint is a ru)e that restri,ts 9a)ues to a
,o)umn in a ta/)e.
13.What is Referentia) &ntegrity? (aintaining 1ata integrity through a set of ru)es that
restri,t the 9a)ues of one or more ,o)umns of the ta/)es /ase1 on the 9a)ues of primary
2ey or uni8ue 2ey of the referen,e1 ta/)e.
14.What is the usage of SA$E!&#TS? SA$E!&#TS are use1 to su/1i9i1e a
transa,tion into sma))er parts. &t ena/)es ro))ing /a,2 part of a transa,tion. (a6imum of
fi9e sa9e points are a))o0e1.
1;.What is # DELETE CASCADE?When # DELETE CASCADE is spe,ifie1
RACLE maintains referentia) integrity /y automati,a))y remo9ing 1epen1ent foreign
2ey 9a)ues if a referen,e1 primary or uni8ue 2ey 9a)ue is remo9e1.
1<.What are the 1ata types a))o0e1 in a ta/)e?CEAR, $ARCEAR., #"(*ER, an1
1>.What is 1ifferen,e /et0een CEAR an1 $ARCEAR.? What is the ma6imum S&GE
a))o0e1 for ea,h type ?CEAR pa1s /)an2 spa,es to the ma6imum )ength. $ARCEAR.
1oes not pa1 /)an2 spa,es.
Hor CEAR it is .;; an1 .DDD for $ARCEAR..
1?.Eo0 many L#F ,o)umns are a))o0e1 in a ta/)e? &s it possi/)e to use L#F
,o)umns in WEERE ,)ause or RDER *-?n)y one L#F ,o)umn is a))o0e1. &t is not
possi/)e to use L#F ,o)umn in WEERE or RDER *- ,)ause.
1C.What are the pre re8uisites? &. to mo1ify 1atatype of a ,o)umn?
ii. to a11 a ,o)umn 0ith #T #"LL ,onstraint ?
To (o1ify the 1atatype of a ,o)umn the ,o)umn must /e empty.
to a11 a ,o)umn 0ith #T #"LL ,onstrain, the ta/)e must /e empty.
.D.Where the integrity ,onstrints are store1 in Data Di,tionary ?The integrity ,onstraints
are store1 in "SER=C#STRA&#TS.
.1.Eo0 0i)) you a a,ti9ateI1ea,ti9ate integrity ,onstraints ?The integrity ,onstraints ,an
/e ena/)e1 or 1isa/)e1 /y ALTER TA*LE E#A*LE ,onstraintID&SA*LE ,onstraint.
...&f an uni8ue 2ey ,onstraint on DATE ,o)umn is ,reate1, 0i)) it 9a)i1ate the ro0s that
are inserte1 0ith S-SDATE ?&t 0onJt, /e,ause S-SDATE format ,ontains time atta,he1
0ith it.
.3.What is a 1ata/ase )in2 ? Data/ase Lin2 is a name1 path through 0hi,h a remote
1ata/ase ,an /e a,,esse1.
.4.Eo0 to a,,ess the ,urrent 9a)ue an1 ne6t 9a)ue from a se8uen,e? &s it possi/)e to
a,,ess the ,urrent 9a)ue in a session /efore a,,essing ne6t 9a)ue? Se8uen,e name
C"RR$AL, Se8uen,e name #E+T$AL.
&t is not possi/)e. n)y if you a,,ess ne6t 9a)ue in the session, ,urrent 9a)ue ,an /e
.;.What are C-CLEI# C-CLE in a Se8uen,e?C-CLE spe,ifies that the se8uen,e
,ontinues to generate 9a)ues after rea,hing either ma6imum or minimum 9a)ue. After pan
as,en1ing se8uen,e rea,hes its ma6imum 9a)ue, it generates its minimum 9a)ue. After a
1es,en1ing se8uen,e rea,hes its minimum, it generates its ma6imum.
# C-CLE spe,ifies that the se8uen,e ,annot generate more 9a)ues after rea,hing its
ma6imum or minimum 9a)ue.
.<.What are the a19antages of $&EW?To prote,t some of the ,o)umns of a ta/)e from
other users.
To hi1e ,omp)e6ity of a 8uery.
To hi1e ,omp)e6ity of ,a),u)ations.
.>.Can a 9ie0 /e up1ate1Iinserte1I1e)ete1? &f -es un1er 0hat ,on1itions?A $ie0 ,an /e
up1ate1I1e)ete1Iinserte1 if it has on)y one /ase ta/)e if the 9ie0 is /ase1 on ,o)umns
from one or more ta/)es then insert, up1ate an1 1e)ete is not possi/)e.
.?.&f a $ie0 on a sing)e /ase ta/)e is manipu)ate1 0i)) the ,hanges /e ref)e,te1 on the
/ase ta/)e?&f ,hanges are ma1e to the ta/)es 0hi,h are /ase ta/)es of a 9ie0 0i)) the
,hanges /e referen,e on the 9ie0.