You are on page 1of 23

Can one use dynamic SQL statements from PL/SQL?

Starting from Oracle8i one can use the "EXECUTE IMMEDIATE" statement to execute d namic S!" and #"$S!" statements %statements created at run& time'( "oo) at these exam*les( +ote that the statements ,ithin -uotes are +OT semicolon terminated. EXECUTE IMMEDIATE /C0EATE TA1"E x %a +UM1E0'/2 Using 3ind 4aria3les((( s-l5stmt .6 /I+SE0T I+TO de*t 7A"UES %.89 .:9 .;'/2 EXECUTE IMMEDIATE s-l5stmt USI+< de*t5id9 de*t5name9 location2 0eturning a cursor((( s-l5stmt .6 /SE"ECT = >0OM em* ?@E0E em*no 6 .id/2 EXECUTE IMMEDIATE s-l5stmt I+TO em*5rec USI+< em*5id2 One can also use the older D1MS5S!" *ac)age %7:(8 and a3o4e' to execute d namic statements( "oo) at these exam*les. C0EATE O0 0E#"ACE #0OCEDU0E DA+S!" AS cur integer2 rc integer2 1E<I+ cur .6 D1MS5S!"(O#E+5CU0SO02 D1MS5S!"(#A0SE%cur9 /C0EATE TA1"E X %A DATE'/9 D1MS5S!"(+ATI7E'2 rc .6 D1MS5S!"(EXECUTE%cur'2 D1MS5S!"(C"OSE5CU0SO0%cur'2 E+D2 $ More com*lex D1MS5S!" exam*le using 3ind 4aria3les. C0EATE O0 0E#"ACE #0OCEDU0E DE#A0TME+TS%+O I+ DE#T(DE#T+O BTA#E' AS 45cursor integer2 45dname char%:C'2 45ro,s integer2 1E<I+ 45cursor .6 D1MS5S!"(O#E+5CU0SO02 D1MS5S!"(#A0SE%45cursor9 /select dname from de*t ,here de*tno D .x/9 D1MS5S!"(7E'2 D1MS5S!"(1I+D57A0IA1"E%45cursor9 /.x/9 no'2 D1MS5S!"(DE>I+E5CO"UM+5C@A0%45cursor9 89 45dname9 :C'2 45ro,s .6 D1MS5S!"(EXECUTE%45cursor'2 loo* if D1MS5S!"(>ETC@50O?S%45cursor' 6 C then exit2 end if2 D1MS5S!"(CO"UM+57A"UE5C@A0%45cursor9 89 45dname'2

D1MS5OUT#UT(#UT5"I+E%/De*tartment name. /FF45dname'2 end loo*2 D1MS5S!"(C"OSE5CU0SO0%45cursor'2 EXCE#TIO+ ,hen others then D1MS5S!"(C"OSE5CU0SO0%45cursor'2 raise5a**lication5error%&:CCCC9 /Un)no,n Exce*tion 0aised. /FFs-lcodeFF/ /FF s-lerrm'2 E+D2 $ What is the difference between %TYPE and %R WTYPE? 1oth BTA#E and B0O?TA#E are used to define 4aria3les in #"$S!" as it is defined ,ithin the data3ase( If the datat *e or *recision of a column changes9 the *rogram automicall *ic)s u* the ne, definition from the data3ase ,ithout ha4ing to ma)e an code changes( The BTA#E and B0O?TA#E constructs *ro4ide data inde*endence9 reduces maintenance costs9 and allo,s *rograms to ada*t as the data3ase changes to meet ne, 3usiness needs( %TYPE BTA#E is used to declare a field ,ith the same t *e as that of a s*ecified ta3le/s column( Exam*le. DEC"A0E 45Em*+ame em*(enameBTA#E2 1E<I+ SE"ECT ename I+TO 45Em*+ame >0OM em* ?@E0E 0O?+UM 6 82 D1MS5OUT#UT(#UT5"I+E%/+ame 6 / FF 45Em*+ame'2 E+D2 $ %R WTYPE B0O?TA#E is used to declare a record ,ith the same t *es as found in the s*ecified data3ase ta3le9 4ie, or cursor( Exam*les. DEC"A0E 45em* em*B0O?TA#E2 1E<I+ 45em*(em*no .6 8C2 45em*(ename .6 /XXXXXXX/2 E+D2 $ What is the resu!t of com"arin# $%LL with $%LL?

+U"" is neither e-ual to +U""9 nor it is not e-ual to +U""( An com*arison to +U"" is e4aluated to +U""( "oo) at this code exam*le to con4ince ourself. declare a num3er .6 +U""2 3 num3er .6 +U""2 3egin if a63 then d3ms5out*ut(*ut5line%/True9 +U"" 6 +U""/'2 elsif aGD3 then d3ms5out*ut(*ut5line%/>alse9 +U"" GD +U""/'2 else d3ms5out*ut(*ut5line%/Undefined +U"" is neither 6 nor GD to +U""/'2 end if2 end2 The out*ut ,ould 3e. S!"D $ Undefined +U"" is neither 6 nor GD to +U"" #"$S!" *rocedure successfull com*leted(H$codeI Wor&arounds' Use IS +U"" or IS +OT +U"". declare a num3er .6 +U""2 3 num3er .6 +U""2 3egin if a IS +U"" and 3 IS +U"" then d3ms5out*ut(*ut5line%/1oth 4alues are +U""(/'2 end if2 end2 Use the +7"%' or +7":%' function( Exam*le. declare a num3er .6 +U""2 3 num3er .6 +U""2 3egin if n4l%a9 JJJJJ' 6 n4l%39 JJJJJ' then d3ms5out*ut(*ut5line%/1oth 4alues are +U""(/'2 end if2 end2 DEC"A0E 45Em*0ecord em*B0O?TA#E2 1E<I+ SE"ECT = I+TO 45Em*0ecord >0OM em* ?@E0E 0O?+UM 6 82 D1MS5OUT#UT(#UT5"I+E%/+ame 6 / FF 45Em*0ecord(ename'2

D1MS5OUT#UT(#UT5"I+E%/Salar 6 / FF 45Em*0ecord(sal'2 E+D2 $ (ow does one #et the )a!ue of a se*uence into a PL/SQL )ariab!e? As ou might )no,9 one cannot use se-uences directl from #"$S!"( Oracle %for some sill reason' *rohi3its this. i .6 s-5se-uence(+EXT7A"2 @o,e4er9 one can use em3edded S!" statements to o3tain se-uence 4alues. select s-5se-uence(+EXT7A" into .i from dual2 What is a mutatin# and constrainin# tab!e? "Mutating" means "changing"( A mutating ta3le is a ta3le that is currentl 3eing modified 3 an u*date9 delete9 or insert statement( ?hen a trigger tries to reference a ta3le that is in state of flux %3eing changed'9 it is considered "mutating" and raises an error since Oracle should not return data that has not et reached its final state( Another ,a this error can occur is if the trigger has statements to change the *rimar 9 foreign or uni-ue )e columns of the ta3le off ,hich it fires( If ou must ha4e triggers on ta3les that ha4e referential constraints9 the ,or)around is to enforce the referential integrit through triggers as ,ell( There are se4eral restrictions in Oracle regarding triggers. A ro,&le4el trigger cannot -uer or modif a mutating ta3le( %Of course9 +E? and O"D still can 3e accessed 3 the trigger'( A statement&le4el trigger cannot -uer or modif a mutating ta3le if the trigger is fired as the result of a CASCADE delete( Etc( What is the difference between stored "rocedures and functions? >unctions are normall used for com*utations ,here as *rocedures are normall used for executing 3usiness logic( >unctions MUST return a 4alue9 *rocedures doesn/t need to( Aou can ha4e DM" %insert9u*date9 delete' statements in a function( 1ut9 ou cannot call such a function in a S!" -uer ( >or exam*le9 if ou ha4e a function that is u*dating a ta3le9 ou cannot call that function from a S!" -uer (

select m >unction%field' from someta3le2 ,ill thro, error( >unction returns 8 4alue onl ( #rocedure can return multi*le 4alues %max 8C:K'( Stored #rocedure. su**orts deferred name resolution( Exam*le ,hile ,riting a stored *rocedure that uses ta3le named ta3l8 and ta3l: etc((3ut actuall not exists in data3ase is allo,ed onl in during creation 3ut runtime thro,s error >unction ,ont su**ort deferred name resolution( Stored *rocedure returns al,a s integer 4alue 3 default Lero( ,here as function return t *e could 3e scalar or ta3le or ta3le 4alues%S!" Ser4er'( Stored *rocedure is *recom*iled execution *lan ,here as functions are not( A *rocedure ma modif an o3Mect ,here a function can onl return a 4alue( #S. In earlier releases of Oracle it ,as 3etter to *ut as much code as *ossi3le in *rocedures rather than triggers( At that stage *rocedures executed faster than triggers as triggers had to 3e re&com*iled e4er time 3efore executed %unless cached'( In more recent releases 3oth triggers and *rocedures are com*iled ,hen created %stored *&code' and one can add as much code as one li)es in either *rocedures or triggers( ================================================================

+ifference between user defined function and stored "rocedure Advantages of User Defined Functions 1efore S!" :CCC9 User Defined >unctions %UD>s'9 ,ere not a4aila3le( Stored #rocedures ,ere often used in their *lace( ?hen ad4antages or disad4antages of User Defined >unctions are discussed9 the com*arison is usuall to Stored #rocedures( One of the ad4antages of User Defined >unctions o4er Stored #rocedures9 is the fact that a UD> can 3e used in a Select9 ?here9 or Case statement( The also can 3e used to create Moins( In addition9 User Defined >unctions are sim*ler to in4o)e than Stored #rocedures from inside another S!" statement( Disadvantages of User Defined Functions User Defined >unctions cannot 3e used to modif 3ase ta3le information( The DM" statements I+SE0T9 U#DATE9 and DE"ETE cannot 3e used on 3ase ta3les( Another disad4antage is that S!" functions that return non&deterministic 4alues are not allo,ed to 3e called from inside User Defined >unctions( <ETDATE is an exam*le of a non&deterministic function( E4er time the function is called9 a different 4alue is returned( Therefore9 <ETDATE cannot 3e called from inside a UD> ou create(

Types of User Defined Functions There are three different t *es of User Defined >unctions( Each t *e refers to the data 3eing returned 3 the function( Scalar functions return a single 4alue( In "ine Ta3le functions return a single ta3le 4aria3le that ,as created 3 a select statement( The final UD> is a Multi&statement Ta3le >unction( This function returns a ta3le 4aria3le ,hose structure ,as created 3 hand9 similar to a Create Ta3le statement( It is useful ,hen com*lex data mani*ulation inside the function is re-uired( Scalar UDFs Our first User Defined >unction ,ill acce*t a date time9 and return onl the date *ortion( Scalar functions return a 4alue( >rom inside !uer Anal Ler9 enter.

C0EATE >U+CTIO+ d3o(DateOnl %NInDateTime datetime' 0ETU0+S 4archar%8C' AS 1E<I+ DEC"A0E NM Out*ut 4archar%8C' SET NM Out*ut 6 CO+7E0T%4archar%8C'9NInDateTime98C8' 0ETU0+ NM Out*ut E+D To call our function9 execute. SE"ECT d3o(DateOnl %<ETDATE%'' +otice the User Defined >unction must 3e *refaced ,ith the o,ner name9 D1O in this case( In addition9 <ETDATE can 3e used as the in*ut *arameter9 3ut could not 3e used inside the function itself( Other 3uilt in S!" functions that cannot 3e used inside a User Defined >unction include. 0A+D9 +E?ID9 NNCO++CECTIO+S9 NNTIMETICOS9 and NN#ACO5SE+T( An 3uilt in function that is non&deterministic( The statement 3egins 3 su**l ing a function name and in*ut *arameter list( In this case9 a date time 4alue ,ill 3e *assed in( The next line defines the t *e of data the UD> ,ill return( 1et,een the 1E<I+ and E+D 3loc) is the statement code( Declaring the out*ut 4aria3le ,as for clarit onl ( This function should 3e shortened to.

C0EATE >U+CTIO+ testDateOnl %NInDateTime datetime' 0ETU0+S 4archar%8C' AS 1E<I+ 0ETU0+ CO+7E0T%4archar%8C'9NInDateTime98C8' E+D

Inline Table UDFs These User Defined >unctions return a ta3le 4aria3le that ,as created 3 a single select statement( Almost li)e a sim*l constructed non&u*data3le 4ie,9 3ut ha4ing the 3enefit of acce*ting in*ut *arameters( This next function loo)s all the em*lo ees in the *u3s data3ase that start ,ith a letter that is *assed in as a *arameter( In !uer Anal Ler9 enter and run.

USE *u3s <O C0EATE >U+CTIO+ d3o("oo)1 >+ame%N>irst"etter char%8'' 0ETU0+S TA1"E AS 0ETU0+ SE"ECT = >0OM em*lo ee ?@E0E "E>T%fname9 8' 6 N>irst"etter To use the ne, function9 enter. SE"ECT = >0OM d3o("oo)1 >+ame%PA/' All the ro,s ha4ing a first name starting ,ith A ,ere returned( The return is a Ta3le 7aria3le9 not to 3e confused ,ith a tem*orar ta3le( Ta3le 4aria3les are ne, in S!" :CCC( The are a s*ecial data t *e ,hose sco*e is limited to the *rocess that declared it( Ta3le 4aria3les are stated to ha4e *erformance 3enefits o4er tem*orar ta3les( +one of m *ersonal testing has found this result though( Multi Statement UDFs Multi Statement User Defined >unctions are 4er similar to Stored #rocedures( The 3oth allo, com*lex logic to ta)e *lace inside the function( There are a num3er of restrictions uni-ue to functions though( The Multi Statement UD> ,ill al,a s return a ta3le 4aria3leQand onl one ta3le 4aria3le( There is no ,a to return multi*le result sets( In addition9 a User Defined >unction cannot call a Stored #rocedure from inside itself( The also cannot execute d namic S!"( 0emem3er also9 that UD>s cannot use non&deterministic 3uilt in functions( So <ETDATE and 0A+D cannot 3e used( Error handling is restricted( 0AISE00O0 and NNE00O0 are in4alid from inside User Defined >unctions( "i)e other *rogramming languages9 the *ur*ose of a User Defined >unction is to create a stand&alone code module to 3e reused o4er and o4er 3 the glo3al a**lication( >or a Multi Statement test9 ,e ,ill create a modified 4ersion of the "oo)1 >+ame function( This ne, function ,ill acce*t the same in*ut *arameter( 1ut rather than return a ta3le from a sim*le select9 a s*ecific ta3le ,ill 3e created9 and data in it ,ill 3e mani*ulated *rior to the return.

C0EATE >U+CTIO+ d3o(multi5test%N>irst"etter char%8'' 0ETU0+S N0esult TA1"E % fname 4archar%:C'9 hire5date datetime9 on5*ro3ation char%8' ' AS 1E<I+ I+SE0T I+TO N0esult %fname9 hire5date' SE"ECT fname9 hire5date >0OM em*lo ee ?@E0E "E>T%fname9 8' 6 N>irst"etter U#DATE N0esult SET on5*ro3ation 6 R+P U#DATE N0esult SET on5*ro3ation 6 RAP ?@E0E hire5date G RC8$C8$8JJ8S E+D 0ETU0+

To use the ne, function9 execute. SE"ECT = >0OM d3o(multi5test%PA/' ?ith the ne, Multi Statement >unction9 ,e can mani*ulate data li)e a Stored #rocedure9 3ut use it in statement areas li)e a 7ie,( >or exam*le9 onl s*ecific columns can 3e returned( SE"ECT fname >0OM d3o(multi5test%PA/' The function can also 3e Moined li)e a 4ie,. SE"ECT e(lname9 f(fname >0OM em*lo ee e I++E0 TOI+ d3o(multi5test%PA/' f O+ e(fname 6 f(fname Conclusion User Defined >unctions offer an excellent ,a to ,or) ,ith code sni**ets( The main re-uirement is that the function 3e self&contained( +ot 3eing a3le to use non&deterministic 3uilt in functions is a *ro3lem9 3ut if it can 3e ,or)ed around9 UD>s ,ill *ro4ide ou ,ith a *rogramming *lus(

SQL SER,ER'./0What is norma!i1ation? Ans. ?ell a relational data3ase is 3asicall com*osed of ta3les that contain related data( So the #rocess of organiLing this data into ta3les is actuall referred to as normaliLation( .20What is a Stored Procedure? Ans. Its nothing 3ut a set of T&S!" statements com3ined to *erform a single tas) of se4eral tas)s( Its 3asicall li)e a Macro so ,hen ou in4o)e the Stored *rocedure9 ou actuall run a set of statements( .30Can you #i)e an e4am"!e of Stored Procedure? Ans. s*5hel*d3 9 s*5,ho:9 s*5renamed3 are a set of s stem defined stored *rocedures( ?e can also ha4e user defined stored *rocedures ,hich can 3e called in similar ,a What is a tri##er? Ans. Triggers are 3asicall used to im*lement 3usiness rules( Triggers is also similar to stored *rocedures( The difference is that it can 3e acti4ated ,hen data is added or edited or deleted from a ta3le in a data3ase( .50What is a )iew? Ans. If ,e ha4e se4eral ta3les in a d3 and ,e ,ant to 4ie, onl s*ecific columns from s*ecific ta3les ,e can go for 4ie,s( It ,ould also suffice the needs of securit some times allo,ing s*ecfic users to see onl s*ecific columns 3ased on the *ermission that ,e can configure on the 4ie,( 7ie,s also reduce the effort that is re-uired for ,riting -ueries to access s*ecific columns e4er time( .60What is an 7nde4? Ans. ?hen -ueries are run against a d39 an index on that d3 3asicall hel*s in the ,a the data is sorted to *rocess the -uer for faster and data retrie4als are much faster ,hen ,e ha4e an index( .80What are the ty"es of inde4es a)ai!ab!e with SQL Ser)er? Ans. There are 3asicall t,o t *es of indexes that ,e use ,ith the S!" Ser4er( Clustered and the +on&Clustered( /90What is the basic difference between c!ustered and a non-c!ustered inde4? Ans. The difference is that9 Clustered index is uni-ue for an gi4en ta3le and ,e can ha4e onl one clustered index on a ta3le( The leaf le4el of a clustered index is the actual data and the data is resorted in case of clustered index( ?hereas in case of non&clustered index the leaf le4el is actuall a *ointer to the data in ro,s so ,e can ha4e as man non&clustered indexes as ,e can on the d3( /:0What are cursors?

Ans. ?ell cursors hel* us to do an o*eration on a set of data that ,e retrei4e 3 commands such as Select columns from ta3le( >or exam*le . If ,e ha4e du*licate records in a ta3le ,e can remo4e it 3 declaring a cursor ,hich ,ould chec) the records during retrei4al one 3 one and remo4e ro,s ,hich ha4e du*licate 4alues( /;0When do we use the %P+<TE=ST<T7ST7CS command? Ans. This command is 3asicall used ,hen ,e do a large *rocessing of data( If ,e do a large amount of deletions an modification or 1ul) Co* into the ta3les9 ,e need to 3asicall u*date the indexes to ta)e these changes into account( U#DATE5STATISTICS u*dates the indexes on these ta3les accordingl ( /.0SQL Ser)er runs on which TCP/7P "ort? Ans. S!" Ser4er runs on *ort 8K;; 3ut ,e can also change it for 3etter securit ( //0>rom where can you chan#e the defau!t "ort? Ans. >rom the +et,or) Utilit TC#$I# *ro*erties &&D #ort num3er(3oth on client and the ser4er( /20Can you te!! me the difference between +ELETE ? TR%$C<TE commands? Ans. Delete command remo4es the ro,s from a ta3le 3ased on the condition that ,e *ro4ide ,ith a ?@E0E clause( Truncate ,ill actuall remo4e all the ro,s from a ta3le and there ,ill 3e no data in the ta3le after ,e run the truncate command( /30Can we use Truncate command on a tab!e which is referenced by > RE7@$ AEY? Ans. +o( ?e cannot use Truncate command on a ta3le ,ith >oreign Oe 3ecause of referential integrit ( /50What is the use of +BCC commands? Ans. D1CC stands for data3ase consistenc chec)er( ?e use these commands to chec) the consistenc of the data3ases9 i(e(9 maintenance9 4alidation tas) and status chec)s( /60Can you #i)e me some +BCC command o"tions?C+atabase consistency chec&D Ans. D1CC C@ECOD1 & Ensures that ta3les in the d3 and the indexes are correctl lin)ed(and D1CC C@ECOA""OC & To chec) that all *ages in a d3 are correctl allocated( D1CC S!"#E0> & It gi4es re*ort on current usage of transaction log in *ercentage( D1CC C@ECO>I"E<0OU# & Chec)s all ta3les file grou* for an damage( /80What command do we use to rename a db? Ans. s*5renamed3 /oldname/ 9 /ne,name/ 290We!! sometimes s"=reanmedb may not wor& you &now because if some one is usin# the db it wi!! not acce"t this command so what do you thin& you can do in such cases?

Ans. In such cases ,e can first 3ring to d3 to single user using s*5d3o*tions and then ,e can rename that d3 and then ,e can rerun the s*5d3o*tions command to remo4e the single user mode( 2:0What is the difference between a (<,7$@ CL<%SE and a W(ERE CL<%SE? Ans. @a4ing Clause is 3asicall used onl ,ith the <0OU# 1A function in a -uer ( ?@E0E Clause is a**lied to each ro, 3efore the are *art of the <0OU# 1A function in a -uer ( 2;0What do you mean by C LL<T7 $? Ans. Collation is 3asicall the sort order( There are three t *es of sort order Dictionar case sensiti4e9 Dictonar & case insensiti4e and 1inar ( 2.0What is a Eoin in SQL Ser)er? Ans. Toin actuall *uts data from t,o or more ta3les into a single result set( 2/0Can you e4"!ain the ty"es of Eoins that we can ha)e with S*! Ser)er? Ans. There are three t *es of Moins. Inner Toin9 Outer Toin9 Cross Toin 220When do you use SQL Profi!er? Ans. S!" #rofiler utilit allo,s us to 3asicall trac) connections to the S!" Ser4er and also determine acti4ities such as ,hich S!" Scri*ts are running9 failed Mo3s etc(( 230What is a Lin&ed Ser)er? Ans. "in)ed Ser4ers is a conce*t in S!" Ser4er 3 ,hich ,e can add other S!" Ser4er to a <rou* and -uer 3oth the S!" Ser4er d3s using T&S!" Statements( 250Can you !in& on!y other SQL Ser)ers or any database ser)ers such as rac!e etc00 Ans. ?e can lin) an ser4er *ro4ided ,e ha4e the O"E&D1 *ro4ider from Microsoft to allo, a lin)( >or Oracle ,e ha4e a O"E&D1 *ro4ider for oracle that microsoft *ro4ides to add it as a lin)ed ser4er to the s-l ser4er grou*( 260Which stored "rocedure wi!! you be runnin# to add a !in&ed ser)er? Ans. s*5addlin)edser4er9 s*5addlin)edsr4login 280What are the S ser)ices that the SQL Ser)er insta!!ation adds? Ans. MS S!" SE07E0 SE07ICE9 S!" A<E+T SE07ICE9 DTC %Distri3ution transac co&ordinator' 390Can you e4"!ain the ro!e of each ser)ice? Ans. S!" SE07E0 & is for running the data3ases S!" A<E+T & is for automation such as To3s9 D1 Maintanance9 1ac)u*s DTC & Is for lin)ing and connecting to other S!" Ser4ers 3:0(ow do you troub!eshoot SQL Ser)er if its runnin# )ery s!ow?

Ans. >irst chec) the *rocessor and memor usage to see that *rocessor is not a3o4e 8CB utiliLation and memor not a3o4e KC&KUB utiliLation then chec) the dis) utiliLation using #erformance Monitor9 Secondl 9 use S!" #rofiler to chec) for the users and current S!" acti4ities and Mo3s running ,hich might 3e a *ro3lem( Third ,ould 3e to run U#DATE5STATISTICS command to u*date the indexes 3;0Lets say due to $/W or Security issues c!ient is not ab!e to connect to ser)er or )ice )ersa0 (ow do you troub!eshoot? Ans. >irst I ,ill loo) to ensure that *ort settings are *ro*er on ser4er and client +et,or) utilit for connections( OD1C is *ro*erl configured at client end for connection &&&&&&Ma)e*i*e V read*i*e are utilities to chec) for connection( Ma)e*i*e is run on Ser4er and read*i*e on client to chec) for an connection issues( 3.0What are the authentication modes in SQL Ser)er? Ans. ?indo,s mode and mixed mode %S!" V ?indo,s'( 3/0Where do you thin& the users names and "asswords wi!! be stored in s*! ser)er? Ans. The get stored in master d3 in the s sxlogins ta3le( 320What is !o# shi""in#? Can we do !o#shi""in# with SQL Ser)er 509 Ans. "ogshi**ing is a ne, feature of S!" Ser4er :CCC( ?e should ha4e t,o S!" Ser4er & Enter*rise Editions( >rom Enter*rise Manager ,e can configure the logshi**ing( In logshi**ing the transactional log file from one ser4er is automaticall u*dated into the 3ac)u* data3ase on the other ser4er( If one ser4er fails9 the other ser4er ,ill ha4e the same d3 and ,e can use this as the D0 %disaster reco4er ' *lan( 330Let us say the SQL Ser)er crashed and you are rebui!din# the databases including the master data3ase ,hat *rocedure to ou follo,W Ans. >or restoring the master d3 ,e ha4e to sto* the S!" Ser4er first and then from command line ,e can t *e S!"SE07E0 Qm ,hich ,ill 3asicall 3ring it into the maintenance mode after ,hich ,e can restore the master d3( 350Let us say master db itse!f has no bac&u"0 $ow you ha)e to rebui!d the db so what &ind of action do you ta&e? Ans. %I am not sure& 3ut I thin) ,e ha4e a command to do it'(
What is a C -REL<TE+ S%BQ%ERY A CO&0E"ATED SU1!UE0A is one that has a correlation name as ta3le or 4ie, designator in the >0OM clause of the outer -uer and the same correlation name as a -ualifier of a search condition in the ?@E0E clause of the su3-uer ( eg SE"ECT field8 from ta3le8 X ?@E0E field:D%select a4g%field:' from ta3le8 A ,here

field86X(field8'2 %The su3-uer in a correlated su3-uer is re4aluated for e4er ro, of the ta3le or 4ie, named in the outer -uer (' What are )arious Foins used whi!e writin# S%BQ%ER7ES Se!f Foin&Its a Moin foreign )e of a ta3le references the same ta3le( uter EoinQIts a Moin condition used ,here One can -uer all the ro,s of one of the ta3les in the Moin condition e4en though the donPt satisf the Moin condition( E*ui-FoinQIts a Moin condition that retrie4es ro,s from one or more ta3les in ,hich one or more columns in one ta3le are e-ual to one or more columns in the second ta3le( What are )arious constraints used in SQL +U"" +OT +U"" C@ECO DE>AU"T What are different TA1"ES 7IE?S I+DEXES SA+O+AMS SE!UE+CES TA1"ES#ACES etc rac!e database obFects

What is difference between Rename and <!ias 0ename is a *ermanent name gi4en to a ta3le or column ,hereas Alias is a tem*orar name gi4en to a ta3le or column ,hich do not exist once the S!" statement is executed( What is a )iew A 4ie, is stored *rocedure 3ased on one or more ta3les9 its a 4irtual ta3le( What are )arious "ri)i!e#es that a user can #rant to another user SE"ECT CO++ECT 0ESOU0CE What is difference between %$7Q%E and PR7G<RY AEY constraints A ta3le can ha4e onl one #0IMA0A OEA ,hereas there can 3e an num3er of U+I!UE )e s( The columns that com*ose #O are automaticall define +OT +U""9 ,hereas a column that com*ose a U+I!UE is not automaticall defined to 3e

mandator must also s*ecif the column is +OT +U""( Can a "rimary &ey contain more than one co!umns Aes (ow you wi!! a)oid du"!icatin# records in a *uery 1 using DISTI+CT What is difference between SQL and SQLHPL%S S!"=#"US is a command line tool ,here as S!" and #"$S!" language interface and re*orting tool( Its a command line tool that allo,s user to t *e S!" commands to 3e executed directl against an Oracle data3ase( S!" is a language used to -uer the relational data3ase%DM"9DC"9DD"'( S!"=#"US commands are used to format -uer result9 Set o*tions9 Edit S!" commands and #"$S!"( Which dataty"e is used for storin# #ra"hics and ima#es "O+< 0A? data t *e is used for storing 1"O1Ps %3inar large o3Mects'( (ow wi!! you de!ete du"!icatin# rows from a base tab!e DE"ETE >0OM ta3le5name A ?@E0E ro,idD%SE"ECT min%ro,id' from ta3le5name 1 ,here 1(ta3le5no6A(ta3le5no'2 C0EATE TA1"E ne,5ta3le AS SE"ECT DISTI+CT = >0OM old5ta3le2 D0O# old5ta3le 0E+AME ne,5ta3le TO old5ta3le DE"ETE >0OM ta3le5name A ?@E0E ro,id +OT I+ %SE"ECT MAX%0O?ID' >0OM ta3le5name <0OU# 1A column5name' What is difference between S%BSTR and 7$STR SU1ST0 returns a s*ecified *ortion of a string eg SU1ST0%P1CDE>P9K' out*ut 1CDE I+ST0 *ro4ides character *osition in ,hich a *attern is found in a string( eg I+ST0%PA1C&DC&>P9/&P9:' out*ut E %:nd occurence of R&P ' ===================================================================

Can a )iew based on another )iew? Aes( What are the ad)anta#es of )iews? & #ro4ide an additional le4el of ta3le securit 9 3 restricting access to a *redetermined set of ro,s and columns of a ta3le( & @ide data com*lexit ( & Sim*lif commands for the user( & #resent the data in a different *ers*ecti4e from that of the 3ase ta3le( & Store com*lex -ueries(

What is an rac!e se*uence? A se-uence generates a serial list of uni-ue num3ers for numerical columns of a data3ase/s ta3les( What is a synonym? A s non m is an alias for a ta3le9 4ie,9 se-uence or *rogram unit( What are the ty"es of synonyms? There are t,o t *es of s non ms *ri4ate and *u3lic( What is a "ri)ate synonym? Onl its o,ner can access a *ri4ate s non m( What is a "ub!ic synonym? An data3ase user can access a *u3lic s non m( What are synonyms used for? & Mas) the real name and o,ner of an o3Mect( & #ro4ide *u3lic access to an o3Mect & #ro4ide location trans*arenc for ta3les9 4ie,s or *rogram units of a remote data3ase( & Sim*lif the S!" statements for data3ase users( What is an rac!e inde4? An index is an o*tional structure associated ,ith a ta3le to ha4e direct access to ro,s9 ,hich can 3e created to increase the *erformance of data retrie4al( Index can 3e created on one or more columns of a ta3le( (ow are the inde4 u"dates? Indexes are automaticall maintained and used 3 Oracle( Changes to ta3le data are automaticall incor*orated into all rele4ant indexes( What is a Tab!es"ace? A data3ase is di4ided into "ogical Storage Unit called ta3les*ace( A ta3les*ace is used to grou*ed related logical structures together What is Ro!!bac& Se#ment ? A Data3ase contains one or more 0oll3ac) Segments to tem*oraril store "undo" information( What are the Characteristics of +ata >i!es ? A data file can 3e associated ,ith onl one data3ase( Once created a data file can/t change siLe( One or more data files form a logical unit of data3ase storage called a ta3les*ace( (ow to define +ata B!oc& si1e ? A data 3loc) siLe is s*ecified for each O0AC"E data3ase ,hen the data3ase is created( A data3ase users and allocated free data3ase s*ace in O0AC"E data 3loc)s( 1loc) siLe is s*ecified in I+IT(O0A file and canPt 3e changed latter(

What does a Contro! fi!e Contain ? A Control file records the *h sical structure of the data3ase( It contains the follo,ing information( Data3ase +ame +ames and locations of a data3ase/s files and redolog files( Time stam* of data3ase creation( What is difference between %$7Q%E constraint and PR7G<RY AEY constraint ? A column defined as U+I!UE can contain +ulls ,hile a column defined as #0IMA0A OEA can/t contain +ulls( What is 7nde4 C!uster ? A Cluster ,ith an index on the Cluster Oe When does a Transaction end ? ?hen it is committed or 0oll3ac)ed( What is the effect of settin# the )a!ue I<LL=R WSI for PT7G7JER=@ <L "arameter of the <LTER SESS7 $ command ? What are the factors that affect PT7G7JER in choosin# an "timi1ation a""roach ? Ans,er The O#TIMIXE05MODE initialiLation *arameter Statistics in the Data Dictionar the O#TIMIXE05<OA" *arameter of the A"TE0 SESSIO+ command hints in the statement( What is the effect of settin# the )a!ue IC( SEI for PT7G7JER=@ <LK "arameter of the <LTER SESS7 $ Command ? The O*timiLer chooses Cost53ased a**roach and o*timiLes ,ith the goal of 3est through*ut if statistics for atleast one of the ta3les accessed 3 the S!" statement exist in the data dictionar ( Other,ise the O#TIMIXE0 chooses 0U"E53ased a**roach( (ow does one create a new database? Cfor +B<D One can create and modif Oracle data3ases using the Oracle "d3ca" %Data3ase Configuration Assistant' utilit ( The d3ca utilit is located in the YO0AC"E5@OME$3in director ( The Oracle Uni4ersal Installer %oui' normall starts it after installing the data3ase ser4er soft,are( One can also create data3ases manuall using scri*ts( This o*tion9 ho,e4er9 is falling out of fashion9 as it is -uite in4ol4ed and error *rone( "oo) at this exam*le for creating and Oracle Ji data3ase. CO++ECT SAS AS SASD1A A"TE0 SASTEM SET D15C0EATE5>I"E5DEST6/$uC8$oradata$/2 A"TE0 SASTEM SET D15C0EATE5O+"I+E5"O<5DEST586/$uC:$oradata$/2 A"TE0 SASTEM SET D15C0EATE5O+"I+E5"O<5DEST5:6/$uC;$oradata$/2 C0EATE DATA1ASE2 What database b!oc& si1e shou!d 7 use? Cfor +B<D Oracle recommends that our data3ase 3loc) siLe match9 or 3e multi*les of our o*erating s stem 3loc) siLe( One can use smaller 3loc) siLes9 3ut the *erformance cost is significant( Aour choice should de*end on the t *e of a**lication ou are

running( If ou ha4e man small transactions as ,ith O"T#9 use a smaller 3loc) siLe( ?ith fe,er 3ut larger transactions9 as ,ith a DSS a**lication9 use a larger 3loc) siLe( If ou are using a 4olume manager9 consider our "o*erating s stem 3loc) siLe" to 3e 8O( This is 3ecause 4olume manager *roducts use 8O 3loc)s %and this is not configura3le'( What are the different a""roaches used by e4ecution "!an ? 0ule&3ased and Cost&3ased( "timi1er in choosin# an

What does R LLB<CA do ? 0O""1ACO retracts an of the changes resulting from the S!" statements in the transaction( (ow does one coa!esce free s"ace ? Cfor +B<D SMO+ coalesces free s*ace %extents' into larger9 contiguous extents e4er : hours and e4en then9 onl for a short *eriod of time( SMO+ ,ill not coalesce free s*ace if a ta3les*ace/s default storage *arameter "*ctincrease" is set to C( ?ith Oracle E(; one can manuall coalesce a ta3les*ace using the A"TE0 TA1"ES#ACE ((( COA"ESCE2 command9 until then use. S!"D alter session set e4ents /immediate trace name coalesce le4el n/2 ?here /n/ is the ta3les*ace num3er ou get from SE"ECT TSZ9 +AME >0OM SAS(TSY2 Aou can get status information a3out this *rocess 3 selecting from the SAS(D1A5>0EE5S#ACE5COA"ESCED dictionar 4ie,( (ow does one "re)ent tab!es"ace fra#mentation? Cfor +B<D Al,a s set #CTI+C0EASE to C or 8CC( 1iLarre 4alues for #CTI+C0EASE ,ill contri3ute to fragmentation( >or exam*le if ou set #CTI+C0EASE to 8 ou ,ill see that our extents are going to ha4e ,eird and ,ac) siLes. 8CCO9 8CCO9 8C8O9 8C:O9 etc( Such extents of 3iLarre siLe are rarel re&used in their entiret ( #CTI+C0EASE of C or 8CC gi4es ou nice round extent siLes that can easil 3e reused( E(g(( 8CCO9 8CCO9 :CCO9 KCCO9 etc( Use the same extent siLe for all the segments in a gi4en ta3les*ace( "ocall Managed ta3les*aces %a4aila3le from 8i on,ards' ,ith uniform extent siLes 4irtuall eliminates an ta3les*ace fragmentation( +ote that the num3er of extents *er segment does not cause an *erformance issue an more9 unless the run into thousands and thousands ,here additional I$O ma 3e re-uired to fetch the additional 3loc)s ,here extent ma*s of the segment are stored( Where can one find the hi#h water mar& for a tab!e? Cfor +B<D There is no single s stem ta3le9 ,hich contains the high ,ater mar) %@?M' for a ta3le( A ta3le/s @?M can 3e calculated using the results from the follo,ing S!" statements. SE"ECT 1"OCOS >0OM D1A5SE<ME+TS ?@E0E O?+E06U##E0%o,ner' A+D SE<ME+T5+AME 6 U##E0%ta3le'2 A+A"AXE TA1"E o,ner(ta3le ESTIMATE STATISTICS2 SE"ECT EM#TA51"OCOS >0OM D1A5TA1"ES ?@E0E O?+E06U##E0%o,ner' A+D SE<ME+T5+AME 6 U##E0%ta3le'2

Thus9 the ta3les/ @?M 6 %-uer result 8' & %-uer result :' & 8 +OTE. Aou can also use the D1MS5S#ACE *ac)age and calculate the @?M 6 TOTA"51"OCOS & U+USED51"OCOS & 8( What is C ST-based a""roach to o"timi1ation ? Considering a4aila3le access *aths and determining the most efficient execution *lan 3ased on statistics in the data dictionar for the ta3les accessed 3 the statement and their associated clusters and indexes( What does C GG7T do ? COMMIT ma)es *ermanent the changes resulting from all S!" statements in the transaction( The changes made 3 the S!" statements of a transaction 3ecome 4isi3le to other user sessions transactions that start onl after transaction is committed( (ow are e4tents a!!ocated to a se#ment? Cfor +B<D Oracle8 and a3o4e rounds off extents to a multi*le of U 3loc)s ,hen more than U 3loc)s are re-uested( If one re-uests 8[O or : 3loc)s %assuming a 8O 3loc) siLe'9 Oracle doesn/t round it u* to U 3loc)s9 3ut it allocates : 3loc)s or 8[O as re-uested( If one as)s for 8 3loc)s9 Oracle ,ill round it u* to 8C 3loc)s( S*ace allocation also de*ends u*on the siLe of contiguous free s*ace a4aila3le( If one as)s for 8 3loc)s and Oracle finds a contiguous free s*ace that is exactl 8 3loc)s9 it ,ould gi4e it ou( If it ,ere J 3loc)s9 Oracle ,ould also gi4e it to ou( Clearl Oracle doesn/t al,a s round extents to a multi*le of U 3loc)s( The exce*tion to this rule is locall managed ta3les*aces( If a ta3les*ace is created ,ith local extent management and the extent siLe is [KO9 then Oracle allocates [KO or 8 3loc)s assuming 8O&3loc) siLe( Oracle doesn/t round it u* to the multi*le of U ,hen a ta3les*ace is locall managed( Can one rename a database user CschemaD? Cfor +B<D +o9 this is listed as Enhancement 0e-uest 8U8UC8( ?or)around. Do a user&le4el ex*ort of user A create ne, user 1 Im*ort s stem$manager fromuser6A touser61 Dro* user A =========================================================

Display the records between two range select rownum, empno, ename from emp where rowid in (select rowid from emp where rownum <=&upto minus select rowid from emp where rownum< &Start); Enter value for upto: 10 Enter value for Start: !"#$%& E&'$" E$(&E ))) ))) )))* 1 +, -.(!/ , ++ S-"00

1 +12 /3$4 5 +55 0%!$E! I know the nvl function only allows the same data type(ie. number or char or date Nvl(comm, 0)), if commission is null then the te t !Not "pplicable# want to display, instead of blank space. $ow do I write the %uery& S6.7 select nvl(to8char(comm9),:$(:) from emp; "utput : $;.(0"8-<(!(-"&&),:$(:) )))))))= $( 100 >00 $( 1500 $( $( 'racle cursor ( Implicit ) * plicit cursors "racle uses wor? areas called private S6. areas to create S6. statements9 '.@S6. construct to identifA each and everA wor? are used, is called as -ursor9 Bor S6. Cueries returninD a sinDle row, '.@S6. declares all implicit cursors9 Bor Cueries that returninD more than one row, the cursor needs to Ee eFplicitlA declared9 * plicit +ursor attributes 0here are four cursor attriEutes used in "racle cursor8nameGBound, cursor8nameG$"0B"%$H, cursor8nameG!"#-"%$0, cursor8nameG3S"'E$ Implicit +ursor attributes Same as eFplicit cursor Eut prefiFed EA the word S6. S6.GBound, S6.G$"0B"%$H, S6.G!"#-"%$0, S6.G3S"'E$ 0ips : 19 <ere S6.G3S"'E$ is false, Eecause oracle automaticallA closed the implicit cursor after eFecutinD S6. statements9 : ,9 (ll are Ioolean attriEutes9 ,ind out nth highest salary from emp table SE.E-0 H3S03$-0 (a9sal) B!"& E&' ( #<E!E &$ = (SE.E-0 -"%$0 (H3S03$-0 (E9sal)) B!"& E&' I #<E!E a9sal<=E9sal); Enter value for n: , S(.

JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ J

19 #hat are the different tApes of KoinsL ,9 EFplain normaliMation with eFamples9 19 #hat cursor tApe do Aou use to retrieve multiple recordsetsL 59 Hiffrence Eetween a NwhereN clause and a NhavinDN clause >9 #hat is the difference Eetween NprocedureN and NfunctionNL O9 <ow will Aou copA the structure of a taEle without copAinD the dataL 9 <ow to find out the dataEase name from S6.J'.%S command promptL +9 0adeoffs with havinD indeFes 29 0al? aEout NEFception <andlinDN in '.@S6.L 109 #hat is the diference Eetween N$%.. in -N and N$%.. in "racleLN 119 #hat is 'roJ-L #hat is "-3L 1,9 4ive some eFamples of (nalAtical functions9 119 #hat is the difference Eetween NtranslateN and NreplaceNL 159 #hat is HP$(&3- S6. method 5L 1>9 <ow to remove duplicate records from a taEleL 1O9 #hat is the use of ($(.PQinD the taElesL 1 9 <ow to run S6. script from a %niF ShellL 1+9 #hat is a NtransactionNL #hA are theA necessarAL 129 EFplain $ormaliMationa dn HenormaliMation with eFamples9 ,09 #hen do Aou Det contraint violtaionL #hat are the tApes of constraintsL ,19 <ow to convert !(# datatApe into 0ER0L ,,9 Hifference * 'rimarA /eA and (DDreDate /eA ,19 <ow functional dependencA is related to dataEase taEle desiDnL ,59 #hat is a NtriDDerNL ,>9 #hA can a NDroup EAN or Norder EAN clause Ee eFpensive to processL ,O9 #hat are N<3$0SNL #hat is NindeF coverinDN of a CuerAL , 9 #hat is a ;3E#L <ow to Det script for a viewL ,+9 #hat are the .arDe oEKect tApes suported EA "racleL ,29 #hat is S6.J.oaderL 109 Hifference Eetween N;(!-<(!N and N;(!-<(!,N datatApes9 119 #hat is the difference amonD NdroppinD a taEleN, NtruncatinD a taEleN and NdeletinD all recordsN from a taEle9 1,9 Hifference Eetween N"!(-.EN and N&3-!"S"B0 (--ESSN dataEases9 119 <ow to create a dataEase lin? L 159 Select the second row in the taEle 1>9 Select the row Eetween 0hird & 10th row9L 1O9 Select even numEer in the the emp taEle9L 1 9 #hat was the o@p for the followinD CuerA 1+9 seelct , from the emp;

'.@S6. interview Cuestions999 19 $ormaliMe manA to manA relationships ,9 Hifference * ECuiKoin and union 19 #hat is 0E&' taEle space in "racle, what is rollEac? seDment 59 <ow do we find row chaininDL >9 'attern matchinD operators O9 Beatures in oracle 2i and 10D 9 #hA truncatinD taEle is faster than delete +9 copA commit sAntaF 29 -onvert Qulu time Mone to %S Eastern time Mone 109 Hifference * union and union all 119 Hifference * 4roup EA, "rder EA clause 1,9 #hich !an?inD functions are availaEleL 119 Hifference * Hecode, $;., $;., 159 0radeoffs of usinD partitioned taEles 1>9 <ow can we call stored procedure in S6. CuerA 1O9 #hat are the restrictions on callinD '.@S6. from S6. 1 9 #hA ER3S0S is preferaEle to distinct 1+9 4ive , eFamples of avoidinD unnecessarA parsinD9
EC(?hat are the different t *es of Moins and ,hat dies each doW E8(?hat are the four main -uer statementsW E:(?hat is a su3&-uer W ?hen ,ould ou use oneW E;(?hat is a +O"OCOW EK(?hat are three S!" )e ,ords used to change or set someonePs *ermissionsW EU(?hat is the difference 3et,een @A7I+< clause and the ?@E0E clauseW E[(?hat is referential integrit W ?hat are the ad4antages of itW EE(?hat is data3ase normaliLationW E8(?hich command using !uer Anal Ler ,ill gi4e ou the 4ersion of S!" ser4er and o*erating s stemW EJ(Using -uer anal Ler9 name ; ,a s ou can get an accurate count of the num3er of records in a ta3leW 8C(?hat is the *ur*ose of using CO""ATE in a -uer W 88(?hat is a triggerW 8:(?hat is one of the first things ou ,ould do to increase *erformance of a -uer W Exam*le \ a -uer ran esterda too) ;C seconds9 toda it ta)es [ minutes] 8;(?hat is an execution *lanW ?hen ,ould ou use itW @o, ,ould ou 4ie, the execution *lanW 8K(?hat is the STU>> function and ho, does it differ from the 0E#"ACE functionW 8U(?hat does it mean to ha4e -uoted5identifier onW ?hat are the im*lications of ha4ing it offW 8[(?hat are the different t *es of re*licationW @o, are the usedW 8E(?hat is the difference 3et,een a local and a glo3al 4aria3leW 88(?hat is the difference 3et,een a "ocal tem*orar ta3le and a <lo3al tem*orar ta3leW @o, is each one usedW

8J(?hat are cursorsW +ame four t *es of cursors and ,hen each one ,ould 3e a**liedW JC(?hat is the *ur*ose of U#DATE STATISTICSW J8(@o, do ou use D1CC statements to monitor 4arious as*ects of a S!" ser4er installationW J:(@o, do ou load large data to the S!" ser4er data3aseW J;(@o, do ou chec) the *erformance of a -uer and ho, do ou o*timiLe itW JK(@o, do S!" ser4er :CCC and XM" lin)edW Can XM" 3e used to access dataW JU(?hat is S!" ser4er agentW J[(?hat is referential integrit and ho, is it achie4edW JE(?hat is indexingW J8(?hat is normaliLation and ,hat are the different forms of normaliLationsW JJ(Difference 3et,een ser4er(transfer and ser4er(execute methodW 8CC(?hat id de&normaliLation and ,hen do ou do itW 8C8(?hat is 3etter& :nd +ormal form or ;rd normal formW ?h W 8C:(Can ,e re,rite su3-ueries into sim*le select statements or ,ith MoinsW Exam*leW 8C;(?hat is a functionW <i4e some exam*leW 8CK(?hat is a stored *rocedureW 8CU(Difference 3et,een >unction and #rocedure&in generalW 8C[(Difference 3et,een >unction and Stored #rocedureW 8CE(Can a stored *rocedure call another stored *rocedure( If es ,hat le4el and can it 3e controlledW 8C8(Can a stored *rocedure call itself%recursi4e'( If es ,hat le4el and can it 3e controlled(W 8CJ(@o, do ou find the num3er of ro,s in a ta3leW 88C(Difference 3et,een Cluster and +on&cluster indexW 888(?hat is a ta3le called9 if it does not ha4e neither Cluster nor +on&cluster IndexW 88:(Ex*lain D1MS9 0D1MSW 88;(Ex*lain 3asic S!" -ueries ,ith SE"ECT from ,here Order 1 9 <rou* 1 & @a4ingW 88K(Ex*lain the 3asic conce*ts of S!" ser4er architectureW 88U(Ex*lain cou*le *f features of S!" ser4er :CCC%Scala3ilit 9 A4aila3ilit 9 Integration ,ith internet9 etc('W 88[(Ex*lain fundamentals of Data ,are housing V O"A#W 88E(Ex*lain the ne, features of S!" ser4er :CCCW 888(@o, do ,e u*grade from S!" Ser4er [(U to E(C and E(C to :CCCW 88J(?hat is data integrit W Ex*lain constraintsW 8:C(Ex*lain some D1CC commandsW 8:8(Ex*lain s*5configure commands9 set commandsW 8::(Ex*lain ,hat are d35o*tions used forW 8:;(?hat is the 3asic functions for master9 msd39 tem*d3 data3asesW 8:K(?hat is a Mo3W 8:U(?hat are tas)sW 8:[(?hat are *rimar )e s and foreign )e sW 8:E(@o, ,ould ou U*date the ro,s ,hich are di4isi3le 3 8C9 gi4en a set of num3ers in columnW 8:8(If a stored *rocedure is ta)ing a ta3le data t *e9 ho, it loo)sW

8:J(@o, m&m relationshi*s are im*lementedW 8;C(@o, do ou )no, ,hich index a ta3le is usingW 8;8(@o, ,ill o u test the stored *rocedure ta)ing t,o *arameters namel first name and last name returning full nameW 8;:(@o, do ou find the error9 ho, can ou )no, the num3er of ro,s effected 3 last S!" statementW 8;;(@o, can ou get NNerror and NNro,count at the same timeW 8;K(?hat are su3&-ueriesW <i4e exam*leW In ,hich case su3&-ueries are not feasi3leW 8;U(?hat are the t *e of MoinsW ?hen do ,e use Outer and Self MoinsW 8;[(?hich 4irtual ta3le does a trigger useW 8;E(@o, do ou measure the *erformance of a stored *rocedureW 8;8(!uestions regarding 0aiseerrorW 8;J(!uestions on identit W 8KC(If there is failure during u*dation of certain ro,s9 ,hat ,ill 3e the stateW ================================================================

19 ,9 19 59 >9 O9 9 +9 29

#hich will Ee faster out of these two Cueries * one with "! or one with 3$L #here does &A3S(& cache taEle recordsL #hich will Ee faster out of Cueries with eFplicit 3$$E! S"3$ and implicit oneL 3s 3nnoHI faster@Eetter than &A3S(&L 3s -<(! faster than ;(!-<(!L 3s ;(!-<(!(+0) faster than ;(!-<(!(,>>)L (re there performance issues when KoininD taEles from different storaDe enDinesL 3f 3 chanDe a derived taEle to a view, will performance increaseL 3f 3 see %sinD temporarA; %sinD filesortT in the EFtra column of ER'.(3$ output, does that mean a temporarA taEle is created on dis?L 109 3s it possiEle to do a B%.. "%0E! S"3$ in &AS6.L
================================================================

You might also like