63
 Codd Rules: Rule 0: For any system to be called a RDBMS, it must Be able to manage database entirely through Its relation capabilities. Rule : !ll in"ormation in a rdbms is represented e#plicitly $at the logical le%el& in e#actly one 'ay, By %alues in table. Rule (: )ach and e%ery datum $atomic %alue& is logically accessible through a combination o" table name, column name and primary *ey %alue. Rule +: Inapplicable or missing In"ormation can be represented through null %alues. Rule : -his rule states that table, %ie' and authoriation access de"initions should be held in e#actly one manner, i.e. !s tables and %ie's. -hese -a bles should be accessible /i*e other tables. Rule :  -here must be atleast one language 'hich is comprehensi%e in supporting data de"i nition, %ie' de"inition, data manipulation, integrity constraints, authoriation, and transaction control. Rule 1: !ll %ie's that are theoretically updateable are updateable by the system. Rule 2: -he capability o" handling a base or a deri%ed table as single operand applies not only to -he retrie%al o" data but also to the insertion, deletion o" data.  !ll select, update, delete must be a%ailable and operate on set s o" ro's in any relation. Rule 3: !pplication programs and terminal acti%ity remain logically unimpaired 'hene%er any changes are made in the storage representation or !ccess method. Rule 4: 5hen in"ormation preser%ing changes o" any *ind that theoretically permit unimpairment are made to the base tables.

sql

  • Upload
    prachi

  • View
    5

  • Download
    0

Embed Size (px)

DESCRIPTION

sql

Citation preview

Page 1: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 1/63

Codd Rules:Rule 0:

For any system to be called a RDBMS, it mustBe able to manage database entirely throughIts relation capabilities.

Rule :!ll in"ormation in a rdbms is represented e#plicitly $at the logical le%el& in e#actly one

'ay,By %alues in table.

Rule (:)ach and e%ery datum $atomic %alue& is logically accessible through a combination o"

table name, column name and primary *ey %alue.Rule +:

Inapplicable or missingIn"ormation can be represented through null %alues.

Rule :-his rule states that table, %ie' and authoriation access de"initions should be held in

e#actly one manner, i.e.!s tables and %ie's. -hese-ables should be accessible/i*e other tables.

Rule :  -here must be atleast one language 'hich is comprehensi%e in supporting data de"inition, %ie'de"inition, data manipulation, integrity constraints, authoriation, and transaction control.

Rule 1:!ll %ie's that are theoretically updateable are updateable by the system.

Rule 2:-he capability o" handling a base or a deri%ed table as single operand applies not only to

-he retrie%al o" data but also to the insertion, deletion o" data.  !ll select, update, delete must be a%ailable and operate on sets o" ro's in any relation.

Rule 3:!pplication programs and terminal acti%ity remain logically unimpaired 'hene%er any

changes are made in the storage representation or!ccess method.Rule 4:

5hen in"ormation preser%ing changes o" any *ind that theoretically permit unimpairmentare made to the base tables.

Page 2: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 2/63

Rule 0:!ll integrity constraints must be de"inable in the data sub language and storable in the

catalogue, not in the application program.

Rule :-he system must ha%e data sub6language, 'hich can support distributed databases'ithout impairing application programs terminal acti%ities.

Rule (:I" the system has a lo'6le%el language, this language can not be used bypass the integrity

rules and constraints e#pressed in the higher le%el relational language.

LAB RECORD:

1) Create the following tables:

Student (roll_no, name, date_of_birth, course_id)

  Course (course_id, name, fee, duration)

S7/8create table course $course9id number $(& primary *ey, name %archar( $&, "eenumber $1&, duration number$(&& S7/8create table student$ roll9no number$2&,name %archar($(&,date9o"9birth date, course9id

 ;umber$(&, primary *ey$roll9no,course9id&, "oreign *ey &course9id& re"erences course&a) Create a program to accept the data from the user

Declare

cid course.course9id<type

cname course.name<type

c"ee course."ee<type

  cduration course."ee<type

 begin

cid:= >course9idcname:=>namec"ee:=>"eecduration:=>duration

Page 3: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 3/63

insert into course %alues$cid,cname,c"ee,cduration&

  end declare

rno student.roll9no<typesname student.name<typedob student.date9o"9birth<typecid student.course9id<type

 beginrno:=> roll9nosname:=> namedob:= >date9o"9birthcid:= >course9id

insert into student %alues$rno,sname,dob,cid&endb) Generate queries to do the following.

i. List all those students who are greater than 18 years of age andhave opted for MCA course.

 SQL> select student1.nameFrom student1 s,course cWhere s.course_id=c.course_id and18<to_char(sysdate,'yyyy'!

  to_char(date_o"_#irth,'yyyy' and c.name li$e 'mca'%ii. List all those courses whose fee is greater than that of MCA

course.

  SQL> select name  "rom course  Where "ee>(select "ee "rom course &here name li$e'mca'%

iii. List all those students who are between 18-19 years of age andhave opted for MCA course.

  SQL> select s.name "rom student1 s,course c  &here s.course_id=c.course_id and

to_char(sysdate,'yyyy'!to_char(date_o"_#irth,'yyyy'in (18 , 1 and c.name li$e 'mca'

Page 4: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 4/63

iv) List all those courses in which nuber of students is less than1!.

  SQL> select c.name "rom course c  &here 1>(select count(roll_no "rom student1 s

&here c.course_id=s.course_id%c) Create "L#$%L procedures to do the following.

i. $et the status of the course to &not offered' in which the nuberof candidates is less than (.

  SQL> alter ta#le course add status )archar* (1+%eclareS )archar*(*%-einS/=0not o""ered0%2date course c set status=sWhere +> (select count (roll_no "rom student1 s&here c.course_id=s.course_id%end%

 ) Create the following tables

  *te+ite,code it,nae ty,in,stoc/reorder,level)  $upplier+supplier,codesupplier,naeaddress)  Can,supply+supplier,codeite,code)

  SQL>3reate ta#le item(4567_36 97-6:(;2rimary $ey, 4567_976 :3:*(*, Q5?_49_S53@ 97-6:(A, :6:6:_L66L 97-6:(*%

  SQL>3reate ta#le su22lier(SBBL46:_36 97-6:(A2rimary$ey,  SBBL46:_976 :3:*(*+,:6SS :3:*(1+%

  SQL>3reate ta#le can_su22ly(SBBL46:_36 97-6:(A,4567_36 97-6:(;,2rimary$ey(SBBL46:_36,4567_36,"orein$ey(SBBL46:_36re"erences SBBL46: , "orein$ey(4567_36re"erences item%

  Create a ro!ram to accet the data from the user

 begin

  insert into item

values(&item_code,'&item_name',&qty_in_stock,&reorder_level);

end

 begin

insert into supplier %alues$>supplier9code,?>supplier9name?,?>address?&

end

Page 5: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 5/63

 begin

insert into can9supply %alues$>supplier9code,>item9code&

end

b)"enerate #ueries to do the follo$in!

i. list all those suppliers who can supply the given item

S7/8 select supplier9name "rom item i,supplier s,can9supply c'here i.item9code=c.item9code and s.supplier9code=c.supplier9codeand item9name li*e ?>item9name?

 ii. list all those items which cannot be supplied by given company.

select item9name"rom item i,supplier s,can9supply c

'here i.item9code=c.item9code and s.supplier9code=c.supplier9code andsupplier9name not li*e ?>supplier9name?c& Create "L#$%L procedures to do the following.

i. Generate a report to list the items whose qty_in_stock is less than or

equal to their reorder_levels.

  declare item item.item9name<typecursor item9report is select item9name "rom item 'here @ty9in9stoc*A=reorder9le%el  beginopen item9reportloop"etch item9report into iteme#it 'hen item9report<not"ounddbms9output.put9line$?item :?item&end loop close item9report end

ii. et the status of supplier to !important ! if the supplier can supply

more than "ve items.

S7/8 alter table supplier add status %archar($(&

  begin  update supplier set status=?important?  'here supplier9code = $select supplier9code  "rom supplier s  'here A=$select count$item9code& "rom can9supply

'here s.supplier9code=supplier9code&&  end

Page 6: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 6/63

iii. Generate report of those items that are supplied by suppliers whose

status is !important#.

 declare item item.item9name<type cursor c( is select item9name"rom supplier s,item i,can9supply c

 'here s.supplier9code=c.supplier9code andi.item9code=c.item9code and

  status li*e ?important?  begin open c(  loop "etch c( into item e#it 'hen c(<not"ound dbms9output.put9line$item&  end loop

  close c( end

1) Create the following tables

  $tudent +roll,nonaecategorydistrictstate)  $tudent,ran/+roll,noar/s ran/)

SQL> create ta#le student*(roll_no num#er(2rimary $ey, name)archar*(*A,cateory )archar*(;, district )archar*(,state)archar*(1+%SQL>create ta#le student_ran$(roll_no num#er(2rimary $ey,mar$snum#er(;,ran$ num#er(+,"orein $ey(roll_nore"erences student*

a) Create a progra to accept the data fro the user

#ein

insert into student*

)alues(Croll_no,'Cname','Ccateory','Cdistict','Cstate'

%

end%

#ein

insert into student_ran$)alues(Croll_no,Cmar$s,Cran$%

end%

 b) 0enerate the ueries to do the following.

Page 7: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 7/63

i) List all those students who coe fro ailnadu state and secured a ran/above 1!!.

SQL> select name "rom student* s,student_ran$ r &here s.roll_no=r.roll_no and ran$>1 and state li$e'tamilnadu'%

ii) List all those students who coe fro Andhrapradesh and belong givencategory who have secured a ran/ above 1!!

select name

 "rom student* s,student_ran$ r

 &here s.roll_no=r.roll_no and ran$>1 and state li$e'andhra2radesh'

 and cateory li$e 'Ccateory'

iii) List naes of students who are having sae ran/ but they should reside indifferent districts

S7/8 select s.name "rom student( s,student9ran* r   &here s.roll_no=r.roll_no and ran$ in (select ran$  "rom student* s1,student_ran$ r1  &here s1.roll_no=r1.roll_no and s.stateD=s1.state  and s.roll_noD=s1.roll_no%iv)List details of students who belong to same category ,same rank .

select s.name"rom student* s,student_ran$ r&here s.roll_no=r.roll_no and ran$ in (select ran$"rom student* s1,student_ran$ r1&here s1.roll_no=r1.roll_no and s.cateory=s1.cateoryand s.roll_noD=S1.roll_no

c) 2rite a "L#$%L procedure to do the following

list of those districts fro which the first 1!! ran/ers coe fro.

declare

dist student*.districtEty2e%cursor c1 is select distinct(district"rom student* s,student_ran$ r&here s.roll_no=r.roll_no and ran$<=1%#eino2en c1%loo2"etch c1 into dist%

Page 8: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 8/63

eit &hen c1Enot"ound%d#ms_out2ut.2ut_line(' 'GGdist%end loo2%close c1%end%

3) Create the following tables

4ranch+branch,idbaranch,naebranch,city)Custorer+custoer,id custoer,naecustoer,citybranch,id)

SQL> create ta#le #ranch(#ranch_id num#er(2rimary

$ey,#ranch_name )archar*(*+,#ranch_city )archar*(1+

SQL> create ta#le customer(customer_id num#er(H2rimary$ey,customer_name )archar*(*+,customer_city

)archar*(1+,#ranch_id num#er(,"orein$ey(#ranch_idre"erences #ranch on delete cascade%

a) Create a for to accept the data fro the user with appropriate validation

chec/s.

#ein

insert into

#ranch(C#ranch_id,'C#ranch_name','C#ranch_city%

end%

o #ein

o insert into customer)alues(Ccustomer_id,'Ccustomer_name','Ccustomer_city',C#ranch_id%

o end%

0enerate ueries to do the following

List all those all custoers who live in the sae city as bthe branch in which they have account

Page 9: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 9/63

SQL> select customer_name "rom #ranch #,customer c

  &here #.#ranch_id=c.#ranch_id and ##ranch_city=customer_city%

List all those custoers who have an account in a given a branch city

SQL> select customer_name

  "rom #ranch #,customer c

  &here #.#ranch_id=c.#ranch_id and#ranch_city='C#ranch_city'%

List all those custoers who have account in ore than one branch

 SQL>select customer_name

  "rom customer c,#ranch #

  &here #.#ranch_id=c.#ranch_id and 1<(selectcount(#ranch_id

  "rom customer c1

  &here c.#ranch_id=c1.#ranch_id%

List all those branches who have ore than 1!! custoers

select distinct(#ranch_name

"rom customer c,#ranch #

&here #.#ranch_id=c.#ranch_id and 1<(select

count(customer_id

"rom customer c1

&here c.#ranch_id=c1.#ranch_id%

Page 10: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 10/63

%& CREA'E SB_ACCO' 'ABLE:

Create table sb9account $account9no number $& primary *ey,customer9name%archar($(0&,balance9amount number$1&& 'O *SER' +ALES *'O SB_ACCO' 'ABLE:

Insert into sb9account %alues $>account9no,>customer9name, >balance9amount&L-S.L ROCEDRE /OR 0*'1DRA0 A A2O':

Declare!no sb9account.account9no<typeBalance sb9account.balance9amount<type5ithdra' number$&Begin

5ithdra':=>'ithdra'!no:=>account9noselect balance9amount into balance "rom sb9account 'here account9no=anodbms9output.put9line$balance=balance&i"$balanceA000& thenDbms9output.put9line$'ithdra' "ails&)nd i"I"$'ithdra'8balance& thenDbms9output..put9line$'ithdra' "ails&

  )lseEpdate sb9account set balance9amount=balance9amount 'ithdra' 'here account9no=ano

)nd i")ndL-S.L BLOC3 /OR DEOS*' SO2E A2O':

DeclareDeposit number$&!no sb9account.account9no<typeBeginDeposit:=>deposit!no:=>account9noEpdate sb9account set balance9amount=balance9amount G deposit 'here account9no=ano

  )nd

CREA'*O O/ COLLE"E_*/O 'ABLE:Create table college9in"o$college9code number$0&primary *ey, college9name%archar($(0&,address %archar($(0&&*SER'*" +ALES *'O COLLE"E_*/O 'ABLE:

Insert into college9in"o %alues $>college9code,>college9name,>address&CREA'*O O/ /ACL'4_*/O 'ABLE:

Page 11: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 11/63

Create table "aculty9in"o$college9code number$0&,"aculty9code number$0&,"aculty9name%archar($(0&,e#p9in9years number$&,address %archar($(0&,@uali"ication %archar($(0&,primary*ey$college9code,"aculty9code&,"oreign *ey$college9code&re"erences college9in"o&*SER'*" +ALES *'O /ACL'4_*/O:

Insert into "aculty9in"o %alues $>college9code, >"aculty9code, >"aculty9name,>e#p9in9years, >address, >@uali"ication&

i) List all those facult5 members $hose e6erience is !reater than or e#ual to %7

5ears and ha8e 2&'ech de!ree&

!ns. Select "aculty9name "rom "aculty9in"o 'here e#p9in9years8=0 and @uali"ication li*eM.-echii) List all those facult5 members, $ho ha8e atleast %7 5ears of e6erience but do

not ha8e 2&'ech de!ree&

!ns. Select "aculty9name "rom "aculty9in"o 'here e#p9in9years80 and @uali"ication notli*e M8-ech

CREA'*O O/ BOO3 'ABLE:

Create table boo* $acc9no number $1& primary *ey, publisher %archar( $(0&,author%archar($(0&,status %archar($(0&,d9o9p date&*SER' SO2E +ALES *'O BOO3 'ABLE:

Insert into boo* %alues $>acc9no,>publisher,>author,>status,>d9o9p&i& List all those boo9s $hich are ne$ arri8als the boo9s $hich are ac#uired durin! the last

months are cate!ori;ed as ne$ arri8als&

Select publisher "rom boo* 'here months9bet'een$sysdate,d9o9p&A=1

ii& List all those boo9s that cannot be issued and urchased <7 5ears a!e

select publisher "rom boo* 'here $to9char$sysdate,yyyy&6

to9char$d9o9p,yyyy&&8=(0

'R*""ER O BOO3 01*C1 SE' S'A'S 'O =CAO' BE *SSED> */ *' *S

BL*S1ED <7 4EARS BAC3&

Create or replace trigger update9boo* be"ore insert on boo* "or each ro' begin

i" inserting thenupdate boo* set status=cannot be issued 'here $to9char

$sysdate,yyyy&6to9char $d9o9p,yyyy&&8=(0end i"

  endCREA'E /ACL'4 'ABLE:

Create table "aculty $"aculty9code number $1& primary *ey, "aculty9name %archar( $(0&,specialiation %archar( $(0&&*SER'*" +ALES:

Insert into "aculty %alues $>"aculty9code, >"aculty9name,>specialation&CREA'E SB?EC' 'ABLE:

Create table subHect $subHect9code number $0&, subHect9name %archar( $(0&, "aculty9codenumber $0&, primary *ey $subHect9code, "aculty9code&, "oreign *ey $"aculty9code&re"erences "aculty&

Page 12: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 12/63

*SER'*" +ALES:

Insert into subHect %alues $>subHect9code, >subHect9name, >"aculty9code&CREA'E S'DE' 'ABLE:

Create table student $roll9no number $&, name %archar( $(0&, subHect9opted number$&, primary *ey $roll9no, subHect9opted&, "oreign *ey $subHect9opted& re"erences

subHect*SER'*" +ALES:

Insert into student %alues $>roll9no,>name,>subHect&i& /ind the number of students $ho ha8e enrolled for the sub@ect DB2S

select name "rom student, subHect 'here subHect9opted=subHect9code and

subHect9name li*e DBMS

ii& /ind all those facult5 members $ho ha8e not offered an5 sub@ect&

Select "aculty9name "rom "aculty ", subHect s 'here "."aculty9code

=s."aculty9code

L-S.L ROCEDRE 'O SE' S'A'S O/ '1E SB?EC' 'O =O' O//ERED>*/

'1E SB?EC' *S O' O'ED B4 A'LEAS' S'DE'S&

 ALTER STUDENT TABLE :

!lter table subHect add status %archar( $(0& PL/SQL PROCEDURE:

Declareno number $(& beginselect count$roll9no& into no "rom student s, student s( 'heres.subHect9opted=s(.subHect9code and subHect9name li*e >subHect i"$noA&

then update subHect set status=not o""eredelse

  update subHect set status=o""ered  end i"

endL-S.L ROCEDRE SE' S'A'S O/ SB?EC' 'O =O' O//ERED> */ '1E

SB?EC' *S O' O//ERED B4 A4 O/ '1E /ACL'4 2E2EBRS&

Declareno number$(& beginselect count$"aculty9code& into no "rom "aculty ", subHect s 'here

"."aculty9code=s."aculty9code and subHect9name li*e >subHect  i"$no==0& then update subHect set status=not o""ered  else

  update subHect setstatus=o""ered end i"

end

Page 13: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 13/63

*DE

Sl&o ro!ram ame a!e o

. Implementation o" DD/ Commands

(. Implementation o" DM/ Commands

+. S7/ Jrogram to display the data o" a table

. Implementation o" Clauses

. S7/ Jrogram by using Relational Jredicates

1. S7/ Jrogram by using !ggregate Functions

2. S7/ Jrogram by using Mathematical Functions

3. J/KS7/ Jrocedures "or results o" students records

4. Function to implement the !rithmetic Lperations

0. Create a Factorial Function

. Illustration o" -riggers on a Student -able

(. Cursor to display the alternate ro's in a table

+. S7/ Report on student table

. Create a Form to accept a data on a -able

. Form "or data %alidations

1. Suggested Readings

2. 5eb Site i" any

3. Commands.

Page 14: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 14/63

%) Creation of database usin! DDL Commands

Aim: -o create the database using the DD/ commands.

*mlementation: -he "ollo'ing operations are used:

a& CR)!-)

 b& !/-)R c& DRLJ-hese operations are e#plained belo':a& CR)!-): -his command is used to create a table. -he synta# is as "ollo's:  CR)!-) -!B/) table6name$Column name data type$n&,

Column name( data type$n&,.. .&  5here Column name is name o" the "ield, data type is the type o" the "ield.

 b& !/-)R: -his command is used to alter a column "rom a table. -he synta# is as "ollo's:  !lter table table6name add "oreign *ey $ & re"erences

c& DRLJ: -his command is used to drop the table. -he synta# is as "ollo's:  DRLJ -!B/) table6name

roblem : Create a database using DD/ commands.

Obser8ations :  Record your results.

Page 15: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 15/63

<) Creation of database usin! DDL Commands

Aim: -o create the database using the DM/ commands.

*mlementation: -he "ollo'ing operations are used:

a& S)/)C- b& I;S)R-c& EJD!-)d& D)/)-)

a& S)/)C-: -his command is used to select the table. -he synta# is as "ollo's:  S)/)C- -!B/) "rom table6name. b& I;S)R-: -his command is used to insert the %alues into an e#isting table. -he synta# is as"ollo's:

I;S)R- I;-L table6name $Column name, Column name(,N..& O!/E)S$%alue, %alue(,N&

c& EJD!-): -his command is used to modi"y the table "ield %alues. -he synta# is as "ollo's:  EJD!-) table6name S)- column=%alue P5Q)R) condition

d& D)/)-): -his command is used to delete the column "rom a table. -he synta# is as "ollo's:  D)/)-) PFRLM table6name P5Q)R) condition

roblem : Create a database using DM/ commands.

Obser8ations :  Record your results.

F) S.L ro!ram to disla5 the data of a table&

Aim: S7/ Jrogram to display the data o" a table.

*mlementation : -he "ollo'ing are used:

Select

-hese operations are e#plained belo':

Page 16: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 16/63

S)/)C-: -his command is used to select the table. -he synta# is as "ollo's:  S)/)C- -!B/) "rom table6name.

roblem : 5rite a S7/ Jrogram to display the data o" a table.

Obser8ations : Record your results.

G) Simle to comle6 condition #uer5 creation usin! clauses

Aim: Simple to comple# condition @uery creation using clauses

*mlementation : -he "ollo'ing operations are used:

a& 5Q)R) C/!ES)

 b& RLEJ BT C/!ES)c& LRD)R BT C/!ES)-hese operations are e#plained belo':

a& 5Q)R) C/!ES): It instructs Lracle to search the data in a table and return only thosero's. -he synta# is as "ollo's:

Select $Column name, Column name(,N& "rom table6name 'here O!/E)S$%alue,%alue(N.&

  b& RLEJ BT C/!ES): It is used to di%ide the ro's in a table into groups and then use thegroup "unctions to return summary in"ormation "or each group. -he synta# us as "ollo's:

  Select column, group9"unction$column& FRLM table P5Q)R) condition  PRLEJ BT group9by9e#pression PLRD)R BT column

  c& LRD)R BT C/!ES): It is used to sort the ro's in either ascending or descending order or multile%el sort. -he synta# is as "ollo's:

S)/)C- column, group9"unction$column& FRLM table P5Q)R) conditionPLRD)R BT column

roblem : 5rite a simple to comple# condition @uery creation using 'here clause, group byclause, order clause.

Obser8ations : Record your results.

) Simle to comle6 condition #uer5 creation usin! relational redicates

Aim: Simple to comple# condition @uery creation using relational predicates

*mlementation: -he "ollo'ing operations are to be used.

Page 17: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 17/63

reater -han

/ess -han or )@ual -o

-est "or ine@uality

Bet'een and !nd Is ;ull

Is ;ot ;ull I;

!;D

LR 

  roblem : 5rite a simple @uery to implement relational predicates.

  Obser8ations : Record your results.

) Simle to comle6 condition #uer5 creation usin! a!!re!ate functions

Aim: Simple to comple# condition @uery creation using aggregate "unctions

*mlementation : -he "ollo'ing operations are used.

CO'

 A+"

 2A

 2*

 S2

  roblem : 5rite a simple @uery to implement aggregate "unctions..

  Obser8ations : Record your results.

H) Simle to comle6 condition #uer5 creation usin! mathematical functions

Aim: Simple to comple# condition @uery creation using mathematical "unctions

*mlementation : -he "ollo'ing operations are used.

Ceil: ;earer 'hole integer greater than or e@ual to number.

Floor: /argest integer e@ual to or less than n.

Mod$m,n&: Remainder o" m di%ided by n. I" n=0, then m is returned.

Jo'er$m,n&: ;umber m raised to the po'er o" n.

Round$n,m&: Result rounded to m places to the right o" the decimal point.

Page 18: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 18/63

Sign$n&: I" n=0, returns 0 i" n80, returns i" nA0, returns 6.

S@rt$n&: S@uare toot o" n.

  roblem : 5rite a simple @uery to implement mathematical "unctions..

  Obser8ations : Record your results.

I) L-S.L rocedures for results of student records

Aim: J/KS7/ procedures "or results o" student records

*mlementation: -he "ollo'ing operations are used:

IF6-Q);6);DIF

IF6-Q);6);DIF: -he se@uence o" statements is e#ecuted only i" the condition is true. I" thecondition is "alse or null, the IF statement does nothing. In either case, control passes to the ne#tstatement. -he synta# is as "ollo's:

I" condition thenSe@uence o" statements)nd i"

roblem : 5rite a J/KS7/ procedure "or results o" students records.

Obser8ations : Record your results.

J) /unction to imlement the arithmetic oerations

Aim: Function to implement the arithmetic operations.

*mlementation : -he "ollo'ing operations are used.

!ddition

Subtraction

Multiplication

Di%ision

IF6-Q);6)/SIF: Sometimes you 'ant to select an action "rom se%eral mutually e#clusi%ealternati%es. -he third "orm o" I" statement uses the *ey'ords )/SIF $not )/S)IF& to introduceadditional conditions. -he synta# is as "ollo's:

Page 19: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 19/63

IF condition -Q);Se@uence o" statements

)/SIF condition( -Q);Se@uence o" statemetns(

)/S)

Se@uence o" statements+);D IF

roblem: 5rite a "unction to implement the arithmetic operations.

Obser8ations : Record your results.

%7) Create a factorial function

Aim: Create a "actorial "unction.

*mlementation : -he "ollo'ing operations are used.

FLR /LLJ: -he number o" iterations through a FLR loops is *no'n be"ore the loop isentered. FLR loops iterate o%er a speci"ied range o" integers. -he range is part o" an iterationscheme, 'hich is enclosed by the *ey 'ords FLR and /LLJS. ! double dot $..& ser%es as therange operator. -he synta# is as "ollo's:

FLR counter I; PR)O)RS) lo'er9bound..higher9bound /LLJSe@uence9o"9statements );D /LLJ

roblem: 5rite a program to create a "actorial "unction.

Obser8ations : Record your results.

%%) *llustration of tri!!ers on a student table

Aim: Illustration o" triggers on a student table

*mlementation : -he "ollo'ing operations are used:

-riggers

-riggers: ! -rigger de"ines an action the database should ta*e 'hen some database related e%entoccurs. -he code 'ithin a trigger, called trigger body is made up o" J/KS7/ bloc*s. -riggers aree#ecuted by the database 'hen speci"ied types o" data manipulation commands are per"ormed onspeci"ic tables. -riggers can be used "or automatic data generation, audit data modi"ications,en"orce comple# Integrity constraints, and customie comple# security authoriations.-he synta# is as "ollo's:

Page 20: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 20/63

Create Por replace trigger Pschema . trigger U be"ore a"ter instead o" VUdml9e%ent9clause U ddl9e%ent Por ddl9e%entN database9e%ent Por database9e%entNV on U Pschema . schema database V V P'hen $condition& UplKs@l9bloc* call9procedure9statement &.

roblem: 5rite a program to illustrate trigger on a student table.

Obser8ations: Record your results.

Page 21: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 21/63

%<) Cursor to disla5 the alternate ro$s in a table&

Aim: Cursor to display the alternate ro's in a table.

*mlementation : -he "ollo'ing are the operations used:

Cursors: -o e#ecute a multi6ro' @uery, Lracle opens an unnamed 'or* area that stores processing in"ormation. ! cursor lets you name the 'or* area, access the in"ormation, and process the ro's indi%idually.LJ);: 5e initialie the cursor 'ith the LJ); statement, 'hich identi"ies the result set.

F)-CQ: 5e use the F)-CQ statement to retrie%e the "irst ro'. 5e can e#ecute the F)-CQrepeatedly until all ro's ha%e been retrie%ed.

C/LS): 5hen the last ro' has been processed, 'e release the cursor 'ith the C/LS)statement.

-he synta# is as "ollo's:

CERSLR cursor9name P $parameter P, parameterN&PR)-ER; return9type IS select9statement5here return9type must represent a record or a ro' in a database table.

roblem: 5rite a program to display the alternate ro's in a table using cursors.

Obser8ations : Record your results.

%F) S.L reort on student table&

Aim: S7/ report on student table.

*mlementation : -he "ollo'ing operations are used:

Reports: Lracle report is the De%eloperK(000 tool that has been pro%ided to produce reports o"data in the Lracle database.Create : -his command is used to create a table. -he synta# is as "ollo's:  CR)!-) -!B/) table6name$Column name data type$n&,

Column name( data type$n&,.. .&  5here Column name is name o" the "ield, data type is the type o" the "ield.

Insert: -his command is used to insert the %alues into an e#isting table. -he synta# is as "ollo's:I;S)R- I;-L table6name $Column name, Column name(,N..& O!/E)S$%alue, %alue(,N&

Page 22: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 22/63

roblem: 5rite a program to create a S7/ report on student table.

Obser8ations: Record your results.

%G) Create a form to accet data on a table&

Aim: Create a "orm to accept data on a table.

*mlementation : -he "ollo'ing are the operations used.

Create: -his command is used to create a table. -he synta# is as "ollo's:  CR)!-) -!B/) table6name$Column name data type$n&,

Column name( data type$n&,.. .&  5here Column name is name o" the "ield, data type is the type o" the "ield.

Form: Lracle "orms are a "eature6rich application building tool that produces production6@uality

screens utiliing data stored in a database.

roblem : 5rite a program to create a "orm to accept data on a table.

Obser8ation: Record your results.

%) /orm for data 8alidations

Aim : Form "or data %alidations.

*mlementation : -he "ollo'ing are the operations used.

-riggers: ! -rigger de"ines an action the database should ta*e 'hen some database related e%entoccurs.

Create Por replace trigger Pschema . trigger U be"ore a"ter instead o" VUdml9e%ent9clause U ddl9e%ent Por ddl9e%entN database9e%ent Por database9e%entNV on U Pschema . schema database V V P'hen $condition& UplKs@l9bloc* call9procedure9statement &.

)lsI": Sometimes you 'ant to select an action "rom se%eral mutually e#clusi%e alternati%es. -hethird "orm o" I" statement uses the *ey'ords )/SIF $not )/S)IF& to introduce additionalconditions. -he synta# is as "ollo's:

IF condition -Q);Se@uence o" statements

)/SIF condition( -Q);Se@uence o" statemetns(

)/S)Se@uence o" statements+

Page 23: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 23/63

);D IF

Form: Lracle "orms are a "eature6rich application building tool that produces production6@ualityscreens utiliing data stored in a database.

roblem : 5rite a "orm "or student data %alidations.

Obser8ations: Record your results.

%) Su!!ested Readin!s

SLO& '*'LE A'1OR BL*CA'*O ED*'*O C1A'ERS

% Oracle

Be!inners

"uide

2ichael

Abbe5

2ichael?&Core5

'ata 2c "ra$

1ill

Oracle

ress

  %,<

< Oracle

1and Boo9 

Bruce

3olste

Da8id

eterson

'ata 2c "ra$

1ill

Oracle

ress

  %,<

F Oracle H&F La8e

Sin!h

3ell5

Lei!h

'ech 2edia SA2S F

G Oracle I

L-S.Lro!rammin!

Scott

man

'ata 2c "ra$

1ill

Oracle

ress

  G

Oracle

De8eloer<777

aul

1isle5

'ech 2edia SA2S

%H) 0eb Site if an5

Lracle.org

Page 24: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 24/63

DDL Commands

Creation of 'able:

-his command is used to create a table. -he synta# is as "ollo's:  CR)!-) -!B/) table6name$Column name data type$n&,

Column name( data type$n&,.. .&5here Column name is name o" the "ield, data type is the type o" the "ield.

 Data '5es:

 ;umber: 5e can store only numeric data %alues in this data type.Char: -his is the alphanumeric data type 'ith "i#ed sie.Oarchar(: -his is also alphanumeric data type 'ith %ariable character length.Date: -his data type can accept only date.Blob: In this data type 'e can store large no. o" data$"iles&.

E6amle:

CR)!-) -!B/) student $roll no number $&, name %archar($(0&,course char$&, doH date&

*nsertin! +alues into a 'able:

-his command is used to Insert %alues into an e#isting table. -he synta# o" Insertcommand is as "ollo's:

I;S)R- I;-L table6name $Column name, Column name(,N..& O!/E)S $%alue,%alue(,N&

E6amle:

  I;S)R- I;-L student $rollno, name, course, doH& O!/E)S

$0,W!nilW,WMC!W,W0KK01W&

datin! a 'able:

-his command is used to modi"y the table "ield %alues. -he synta# is as "ollo's:EJD!-) table6name S)- column=%alue P5Q)R) condition

E6amle:

EJD!-) student S)- sname=RaHesh 5Q)R) sno=00

Deletin! a 'able:

-his command is used to delete the column "rom table. -he synta# is as "ollo's:

D)/)-) PFRLM table6name P5Q)R) condition

E6amle:

D)/)-) FRLM student 5Q)R) sname=RaHesh

Page 25: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 25/63

S.L .ueries:a& 01ERE CLASE: It instructs Lracle to search the data in a table and return only those

ro's.-he synta# is as "ollo's:Select $Column name, Column name(,N& "rom table6name 'here O!/E)S$%alue,%alue(N.&

  E6amle:

Select ename "rom emp 'here Hob = cler* and sal8+000

"RO B4 CLASE: It is used to di%ide the ro's in a table into groups and then use thegroup "unctions to return summary in"ormation "or each group. -he synta# us as "ollo's:

S)/)C- column, group9"unction$column& FRLM table P5Q)R) conditionPRLEJ BT group9by9e#pression PLRD)R BT column

E6amle:

S)/)C- city, count$sname& "rom Salesperson RLEJ BT city

ORDER B4 CLASE: It is used to sort the ro's in either ascending or descending order ormultile%el sort. -he synta# is as "ollo's:

S)/)C- column, group9"unction$column& FRLM table P5Q)R) conditionPLRD)R BT column

E6amle:

S)/)C- "rom che@ues order by amt desc

S.L: It is Structured 7uery /anguage, used to manipulate in"ormation in a relational databaseand used in LR!C/) and IBM DB( relational database management systems. S7/ is "ormally pronounced as Xse@uelW, although common usage also pronounces it XS.7./.W. S7/ is a set o"commands that all programmers must use to access data 'ithin the tables o" Database.S7/ statements are di%ided into the "ollo'ing categories:

• Data De"inition /anguage $DD/& statements.

• Data Manipulation /anguage $DM/& statements.

•  /anguage $DD/& statements.

Relational redicates: 5e use these 'hen it comes to restricting the ro's retrie%ed along 'iththe 'here clause."reater 'han: Select dname, deptno "rom Dept 'here deptno8(0Less 'han or E#ual 'o: select ename "rom emp 'here salA= (000'est for *ne#ualit5: select ename, sal, Dname "rom emp ), Dept D 'here

).deptno = D.deptno and D./oc = /L;DL;Bet$een and And: select sname "rom Salesperson 'here Comm bet'een 0.0 and 0.(*s ull: select "rom Customer 'here City is ;E//*s ot ull: select "rom Dept 'here dname is ;L-;E//*: select ename, city "rom Customer 'here city I; $/L;DL;, RLM), B)R/I;&AD: select "irstname "rom "riends 'here "irst name = !/ and lastname = BE/Q)ROR : select names "rom team 'here hits A0.+ LR abA0.+

Page 26: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 26/63

S.L "rou /unctions: -hese "unctions operate on sets o" ro's to gi%e one result per group.-hese sets may be the 'hole table or the table split into pages.-ypes o" roup Functions are CO', A+", 2A, 2*, S2&

CO': select count $ename&, count $deptno& "rom empA+": select a%g $comm.& "rom salesperson

2A: select ma# $sal& "rom emp2*: select min $comm.& "rom salespersonS2: select sum $amt& "rom orders

 2A'1E2A'*CAL /C'*OS: -hese accept character input and can return both characterand number %alues. -hese are as "ollo'sCeil: ;earer 'hole integer greater than or e@ual to number.E6amle: select ceil$0.1& "rom dual/loor: /argest integer e@ual to or less than n.E6amle: select "loor$0.1& "rom dual

2od(m,n): Remainder o" m di%ided by n. I" n=0, then m is returned.E6amle: select mod$2,& "rom dualo$er(m,n): ;umber m raised to the po'er o" n.E6amle: select po'er$+,(& "rom dualRound(n,m): Result rounded to m places to the right o" the decimal point.E6amle: select round$(+.123,(& "rom dualSi!n(n): I" n=0, returns 0 i" n80, returns i" nA0, returns 6.E6amle: select sign$(& "rom dualS#rt(n&: S@uare toot o" n.E6amle: select s@rt$(& "rom dual

L-S.L rocedure: It is Lracles procedural language e#tension to S7/. It combines the easeand "le#ibility o" S7/ 'ith the procedural "unctionality o" a structured programming language,such as IF..-Q);, 5QI/) and /LLJ.

!s J/KS7/ code can be stored centrally in a database, net'or* tra""ic bet'eenapplications and the database is reduced, so application and system per"ormance increases. Dataaccess can be controlled by stored J/KS7/ can access data only as intended by the applicationde%eloper $unless another access route is granted&. J/KS7/ bloc*s can be sent by an applicationto a database, e#ecuting comple# operations 'ithout e#cessi%e net'or* tra""ic.

)%en 'hen J/KS7/ is not stored in the database, applications can send bloc*s o" J/KS7/ to thedatabase rather than indi%idual S7/ statements, thereby again reducing net'or* tra""ic.

Page 27: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 27/63

-he synta# o" J/KS7/ statement is as "ollo's:

DeclareAdeclarations section8

Begin

Ae#ecutable commands8)#ceptionAe#ception handling8

)nd

E6amle:

declare a number $(& b number $(& begin

  a:=>a  b:=>bi"$a8b& then  dbms output. put line$hello a&else i" $b8a& then  dbms output. put line$hello b&else i" $a=b& then  dbms output. put line$hello a&end i"end

*/K'1EKED*/: -he se@uence o" statements is e#ecuted only i" the condition is true. I" thecondition is "alse or null, the IF statement does nothing. In either case, control passes to the ne#tstatement. -he synta# is as "ollo's:

I" condition thenSe@uence o" statements)nd i"

E6amle:IF sales 8 @uota -Q);Se@uence bonus $empid&EJD!-) payroll Set pay = pay G bonus 5Q)R) empno = emp id);D IF

Arithmetic Oerations: -hese contain only numeric data. -he "ollo'ing are the arithmeticoperators. !ddition

Subtraction

Multiplication

Page 28: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 28/63

Di%ision

*/K'1EKELS*/: Sometimes you 'ant to select an action "rom se%eral mutually e#clusi%ealternati%es. -he third "orm o" I" statement uses the *ey'ords )/SIF $not )/S)IF& to introduceadditional conditions. -he synta# is as "ollo's:

IF condition -Q);Se@uence o" statements

)/SIF condition( -Q);Se@uence o" statemetns(

)/S)Se@uence o" statements+

);D IF

I" the "irst condition is "alse or null, the )/SIF clause tests another condition. !n IF statementcan ha%e any number o" )/SIF clauses, the "inal )/S clause is optional. Conditions are

e%aluated one by one "rom top to bottom. I" any condition is true, its associated se@uence o"statements is e#ecuted and control passes to the ne#t statement.I" all conditions are "alse or null, the se@uence in the )/S clause is e#ecuted.

E6amle:

B)I;IF sales 8 0000 -Q);  Bonus: = 00)/SIF sales 8 +000 -Q);  Bonus: = 00

)/S)  Bonus: = 00);D IF

I;S)R- I;-L payroll O!/E)S $emp id, bonusN&);D

/OR LOO: -he numbers o" iterations through a FLR loop is *no'n be"ore the loop isentered. FLR loops iterate o%er a speci"ied range o" integers. -he range is part o" an iterationscheme, 'hich is enclosed by the *ey 'ords FLR and /LLJS. ! double dot $..& ser%es as the

range operator. -he synta# is as "ollo's:

FLR counter I; PR)O)RS) lo'er9bound..higher9bound /LLJSe@uence9o"9statements );D /LLJ

E6amle:

FLR i I; ..+ /LLJ assign the %alues ,(,+ to i

Page 29: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 29/63

Se@uence 9o" 9statements e#ecutes three times);D /LLJ

'ri!!ers: ! -rigger de"ines an action the database should ta*e 'hen some database related e%entoccurs. -he code 'ithin a trigger, called trigger body is made up o" J/KS7/ bloc*s. -riggers are

e#ecuted by the database 'hen speci"ied types o" data manipulation commands are per"ormed onspeci"ic tables. -riggers can be used "or automatic data generation, audit data modi"ications,en"orce comple# Integrity constraints, and customie comple# security authoriations.-he synta# is as "ollo's:

Create Por replace trigger Pschema . trigger U be"ore a"ter instead o" VUdml9e%ent9clause U ddl9e%ent Por ddl9e%entN database9e%ent Por database9e%entNV on U Pschema . schema database V V P'hen $condition& UplKs@l9bloc* call9procedure9statement &.

E6amle:

Begin

I" updating thenInsert into uptest%alues$:ne'.int,:ne'.name,:ne'.dt&

else%alues$:old.int,:old.name,:old.dt&

end i"end

Cursor: -o e#ecute a multi6ro' @uery, Lracle opens an unnamed 'or* area that stores processing in"ormation. ! cursor lets you name the 'or* area, access the in"ormation, and process the ro's indi%idually.

  J/KS7/ uses t'o types o" cursors: implicit and e#plicit. J/KS7/ declares a cursorimplicitly "or all S7/ data manipulation statements, including @ueries that return only one ro'.For @ueries that return more than one ro', you must declare an e#plicit cursor or use a cursorFLR loop.

*mlicit Cursors: Lracle implicitly opens a cursor to process each S7/ statement not associated'ith an e#plicitly declared cursor. J/KS7/ lets you re"er to the most recent implicit cursor as theS7/ cursor. Tou cannot use the LJ);, F)-CQ, and C/LS) statements to control the S7/cursor. But you can use cursor attributes to get in"ormation about the most recently e#ecutedS7/ statement.

E6licit Cursors: -he set o" ro's returned by a @uery can consist o" ero, one , or multiplero's, depending on ho' multiple ro's, you can e#plicitly declare a cursor to process the ro's.Tou can declare a cursor in the declarati%e part o" any J/KS7/ bloc*, subprogram, or pac*age.

5e use three commands to control a cursor : LJ);, F)-CQ and C/LS). First, 'e initialie thecursor 'ith the LJ); statement, 'hich identi"ies the result set. -hen 'e use the F)-CQstatement to retrie%e the "irst ro'. 5e can e#ecute the F)-CQ repeatedly until all ro's ha%e

Page 30: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 30/63

 been retrie%ed. 5hen the last ro' has been processed, 'e release the cursor 'ith the C/LS)statement. 5e can process se%eral @ueries in parallel by declaring and opening multiple cursors.

-he synta# is as "ollo's:

CERSLR cursor9name P $parameter P, parameterN&PR)-ER; return9 type IS select9statement5here return9type must represent a record or a ro' in a database table.

E6amle:

Declare  Cursor depcur is select "rom dept, emp 'here dept.deptno=emp.deptno

  Deprec dept<ro'typeBegin

  Lpen depcur   For deprec in depcur   /oop  )#it 'hen depcur<not "ound  Deprec:=depcur  Dbms9output.put9line$deprec&)nd loopClose depcur)nd

Reorts: Lracle report is the De%eloperK(000 tool that has been pro%ided to produce reports o"data in the Lracle database. -hese reports can be pre%ie'ed on the user screen be"ore being printed or can be printed directly. -he report output may also be sa%ed in a "ile to be used at alater date. Lracle reports operate in a raphical user Inter"ace $EI& en%ironment such asMicroso"t 5indo's. Functions may be per"ormed by clic*ing iconic buttons or %ia menu pic*s.-he menus used by reports dynamically change based on the current conte#t o" the tool and are"airly intuiti%e as to their speci"ic purpose.

E6amle:

S)- Q)!DS)J --I-/) )MJ/LT)) R)JLR- B-I-/) );D LF R)JLR- CL/EM; S!/ FLRM!- Y 44,444.44BR)!Z L; D)J-;L SZIJ CLMJE-) SEM LF S!/ L; D)J-;LBR)!Z L; R)JLR-CLMJE-) SEM LF S!/ CLMM L; R)JLR-

Page 31: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 31/63

S)- J!)SI[) +0S)/)C- )MJ;L, );!M), \LB, S!/, CLMM, D)J-;L FRLM )MJC/)!R BR)!ZSC/)!R CLMJE-)S

/orms: Lracle "orms are a "eature6rich application building tool that produces production6@uality screens utiliing data stored in a database. 5e can embed graphics, sound, %ideo, 'ora processing documents and spreadsheets through the use o" L/)(. 5e can embed obHects "rom)#cel or 6(6+ "or 'indo's in our Lracle "orms screens. -hese can also share data 'ith otherDe%eloper (000 tools through a special module.

E6amle:

D)C/!R)Dummy9De"ine CQ!R$&

CERSLR ))MJ9cur IS  S)/)C- FRLM ))MJ  5Q)R) :))MJ.D)J-9;L = :D)J-.D)J-9;L

B)I;  LJ); ))MJ9cur  F)-CQ ))MJ9cur I;-L Dummy9De"ine  IF $ ))MJ9cur<"ound & -Q);

  Message $Cannot delete master record 'hen matching detail records e#ist.&C/LS) ))MJ9cur  R!IS) Form9-rigger9Failure);D IFC/LS) ))MJ9cur

);D

Page 32: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 32/63

Oracle Important Questions 

1.  Difference between group functions and single row functions.

Group Function Single Row Function

A group function operates A single row function

on many rows returns one and result for one row.

returns single result.

Not allowed in Pl/sql procedural Allowed in Pl/Sql

Procedural statements

Statements.

e.g. SUM!"A#$"MIN"MA% etc e.g. UPP&'"(O)&'"*+'...

2.  Difference between DECODE and TRAS!ATE

,&*O,& is -alue y -alue 'ANS(A& is c0aracter y

c0aracter replacement. replacement.

&1 S&(&* ,&*O,&2A3*2"2A2"4"232"5"2A3*2"6! eg S&(&*

from dual7 o/p 6 'ANS(A&2A3*$+2"

2A3*,&8$+I92" 456:;<=>??!

8'OM ,UA(7 o/p 456=>

,&*O,& command is used to ring I8"+&N"&(S& logic to SQ(.It tests for t0e I8 -aluess! and t0en+&N -alues! w0en true" t0e &(S& -alues! if not.!

".  Difference between TR#CATE and DE!ETE

Page 33: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 33/63

'UN*A& deletes muc0 faster t0an ,&(&&

Truncate Delete

It is a ,,( statement It is a ,M( statement

It is a one way trip" cannot One can 'ollac@

'O((3A*

,oesn2t 0a-e selecti-e features w0ere clause! +as

,oesn2t fire dataase triggers ,oes

It requires disaling of referential ,oes not require

constraints.

$.  %&at is a CO'RE!ATED S#()#ER*

A *OB'&(A&, SU3QU&'C is one t0at 0as a correlation

name as tale or -iew designator in t0e 8'OM clause of t0e outer

query and t0e same correlation name as a qualifier of a searc0

condition in t0e )+&'& clause of t0e su query.

eg

SELECT field1 from table1 X

WHERE field2>(select avg(field2) from table1 Y

!ere

field1"X#field1)$

0e suquery in a correlated suquery is re-aluated

Page 34: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 34/63

for e-ery row of t0e tale or -iew named in t0e outer query.!

+.  %&at are ,arious -oins used w&ile writing S#()#ERES

Self -oin-Its a join foreign key of a table references the same table.

Outer /oin--Its a join condition used where One can query all the rows of one of the

tales in t0e Doin condition e-en t0oug0 t0ey don2t satisfy t0e Doin condition.

E0ui'-oin--Its a join condition that retrieves rows from one or more tables in which one

or more columns in one tale are equal to one or more columns in t0e second tale.

.  %&at are ,arious constraints used in S)!

%&LL

%'T %&LL

CHEC

E*+&LT

.  %&at are different Oracle database ob-ects

T+,LES

-.EWS

Page 35: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 35/63

.%EXES

SY%'%Y/S

SE0&E%CES

T+,LES+CES etc

3.  %&at is difference between Rena4e and Alias

'ename is a permanent name gi-en to a tale or column w0ereas Alias is a temporary

name gi-en to a tale or column w0ic0 do not e1ist once t0e SQ( statement is

e1ecuted.

5.  %&at is a ,iew

A -iew is stored procedure ased on one or more tales" itEs a -irtual tale.

%&at are ,arious pri,ileges t&at a user can grant to anot&er user

SELECT

C'%%ECT

RES'&RCES

16.  %&at is difference between #)#E and 7R8AR* 9E* constraints

A tale can 0a-e only one R./+RY EY  w0ereas t0ere can e any numer of &%.0&E  @eys.

0e columns t0at compose P are automatically define NO NU((" w0ereas a column t0at co

a &%.0&E  is not automatically defined to e mandatory must also specify t0e column is %'T

 

11.  Can a pri4ar: ;e: contain 4ore t&an one colu4ns

Page 36: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 36/63

 

Ces

12.  <ow :ou will a,oid duplicating records in a 0uer:

3y using .ST.%CT  

1".  %&at is difference between S)! and S)!=7!#S

SQ(FP(US is a command line tool w0ere as SQ( and P(/SQ( language interface and

'eporting tool. Its a command line tool t0at allows user to type SQ( commands to e

&1ecuted directly against an Oracle dataase. SQ( is a language used to query t0e

'elational dataase ,M(" ,*(" ,,(!. SQ(FP(US commands are used to format query

result" Set options" &dit SQ( commands and P(/SQ(.

1$.  %&ic& datat:pe is used for storing grap&ics and i4ages

L'% R+W data type is used for storing BLOBs !binary large objects".

1+.  <ow will :ou delete duplicating rows fro4 a base table

ELETE

*R'/ table#name $

WHERE  rowidGSELECT minrowid! from taleHname 3 w0ere

3.taleHnoA.taleHno!7

Page 37: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 37/63

 

CREATE TABLE  new#table AS SELECT DISTINCT * FROM old#table%

DROP  old#table

RE%+/E   new#table TO  old#table

ELETE 8'OM taleHname A

WHERE   rowid %'T .%  SELECT /+X(R'W.) *R'/  taleHname

R'& ,Y  columnHname!

1.  %&at is difference between S#(STR and STR

SU3S' returns a specified portion of a string

eg SU3S'23*,&82":! output 3*,&

INS' pro-ides c0aracter position in w0ic0 a pattern

is found in a string.

eg INS'2A3*B,*B82"2B2"5! output = 5nd occurence of 2B2!

1.  T&ere is a string >126666 12 6 .12+> ?&ow :ou will find t&e

position of t&e deci4al place

INS'245JJJJ 45 J .45;2"4"2.2!

output 46

Page 38: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 38/63

13.  T&ere is a >@> sign in one field of a colu4n. %&at will be

t&e 0uer: to find it.

2K2 S0ould e used efore 2L2.

15.  %&en :ou use %<ERE clause and w&en :ou use <AG clause

H+-.% clause is used when you want to specify a condition for a group function and it

is written after $'OUP 3C clause

0e WHERE clause is used w0en you want to specify a condition for columns" single

row functions e1cept group functions and it is written efore $'OUP 3C clause if it is

used.

26.  %&ic& is 4ore faster ' or EBSTS

&%ISS is more faster t0an IN ecause &%ISS returns

a 3oolean -alue w0ereas IN returns a -alue.

21.  %&at is a O#TER /O

Outer 9oinBBIts a Doin condition used w0ere you can query all t0e rows of one of t0e

tales in t0e Doin condition e-en t0oug0 t0ey donEt satisfy t0e Doin condition.

Page 39: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 39/63

 

22.  <ow :ou will a,oid :our 0uer: fro4 using indees

S&(&* F 8'OM emp

)0ere empHno2 2456:;7

i.e you 0a-e to concatenate t0e column name wit0

space wit0in codes in t0e w0ere condition.

S&(&* /F 8U((a! F/ ename" empHno from emp

w0ere empHno456:7

i.e using +INS

2".  %&at is a pseudo colu4n. Gi,e so4e ea4ples

It is a column t0at is not an actual column in t0e

tale.

eg US&'" UI," SCS,A&" 'O)NUM" 'O)I," NU((" AN, (&#&(.

2$.  Suppose custo4er table is t&ere &a,ing different colu4ns

li;e custo4er no? pa:4ents.%&at will be t&e 0uer: to select top t&ree 4a pa:4ents.

Page 40: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 40/63

SELECT  customer#no& payments from customer '(

WHERE )*+!SELECT COUNT !," from customer '

WHERE *4.payment *5.payment!

2+.  %&at is t&e purpose of a cluster.

Oracle does not allow a user to specifically locate tales" since t0at is a part of t0e

function of t0e ',3MS. +owe-er" for t0e purpose of increasing performance" oracle alde-eloper to create a CL&STER. A *(US&' pro-ides a means for storing

data from different tales toget0er for faster retrie-al t0an if t0e tale placement were

left to t0e ',3MS.

2.  %&at is a cursor.

Oracle uses wor@ area to e1ecute SQ( statements and store processing information

P(/SQ( construct called a cursor lets you name a wor@ area and access its stored

information A cursor is a mec0anism used to fetc0 more t0an one row in a Pl/SQl

loc@.

2.  Difference between an i4plicit an eplicit cursor.

P(/SQ( declares a cursor implicitly for all SQ( data manipulation statements" including

quries t0at return only one row. +owe-er"queries t0at return more t0an one row you

must declare an e1plicit cursor or use a cursor 8O' loop.

&1plicit cursor is a cursor in w0ic0 t0e cursor name is e1plicitly assigned to a S&(&*

statement -ia t0e *U'SO'...IS statement. An implicit cursor is used for all SQ( state

,eclare" Open" 8etc0" *lose. An e1plicit cursors are used to process multirow S&(&* state

Page 41: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 41/63

An implicit cursor is used to process INS&'" UP,A&"

,&(&& and single row S&(&*. .INO statements.

23.  %&at are cursor attributes

3R'WC'&%T

3%'T*'&%

3*'&%

3.S'E%  

25.  %&at is a cursor for loop.

*ursor 8or (oop is a loop w0ere oracle implicitly declares a loop -ariale" t0e loop inde1 t0atsame record type as t0e cursor2s record.

"6.  Difference between O DATA FO#D and @OTFO#D

NO ,AA 8OUN, is an e1ception raised only for t0e S&(&*....INO statements

w0en t0e w0ere clause of t0e querydoes not matc0 any rows. )0en t0e w0ere clause

of t0e e1plicit cursor does not matc0 any rows t0e LNO8OUN, attriute is set to

'U& instead.

31.  What a SELECT FOR UPDATE cursor represent.

Page 42: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 42/63

 

S&(&*......8'OM......8O'......UP,A&O8 columnBreferenceNO)AI 0e

processing done in a fetc0 loop modifies t0e rows t0at 0a-e een retrie-ed y t0e

cursor.

A con-enient way of modifying t0e rows is done y a met0od wit0 two parts t0e 8O'

UP,A& clause in t0e cursor declaration" )+&'& *U''&N O8 *(AUS& in an

UP,A& or declaration statement.

32.  What 'WHERE CURRET OF ' c!ause "oes #n a cursor.

(OOP

S&(&* numHcredits INO -Hnumcredits 8'OM classes

)+&'& dept456 and course4J47

UP,A& students

S& currentHcreditscurrentHcredits-Hnumcredits

)+&'& *U''&N O8 %7

&N, (OOP

*OMMI7

&N,7

33.  What #s use o$ a cursor %ar#a&!e Ho( #t #s "e$#ne".

Page 43: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 43/63

A cursor -ariale is associated wit0 different statements at run time" w0ic0 can 0old

different -alues at run time. Static cursors can only e associated wit0 one run time

query. A cursor -ariale is reference typeli@e a pointer in *!.

,eclaring a cursor -ariale

CP& typeHname IS '&8 *U'SO' '&U'N returnHtype typeHname is t0e name of

t0e reference type"returnHtype is a record type indicating t0e types of t0e select list

t0at will e-entually e returned y t0e cursor -ariale.

3).  What shou!" &e the return t*pe $or a cursor %ar#a&!e.Can (e use a sca!ar "ata t*pe as return

0e return type for a cursor must e a record type.It can e declared e1plicitly as a

userBdefined or L'O)CP& can e used. eg CP& tHstudentsref IS '&8

*U'SO' '&U'N studentsL'O)CP&

3+.  Ho( *ou open an" c!ose a cursor %ar#a&!e.Wh* #t #s re,u#re".

OP&N cursor -ariale 8O' S&(&*...Statement

*(OS& cursor -ariale In order to associate a cursor -ariale wit0 a particular

S&(&* statement OP&N synta1 is used.In order to free t0e resources used

for t0e query *(OS&

statement is used.

3-.  Ho( *ou (ere pass#n cursor %ar#a&!es #n PL/S0L 2.2.

In P(/SQ( 5.5 cursor -ariales cannot e declared in a [email protected] is ecause t0e storage

Page 44: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 44/63

cursor -ariale 0as to e allocated using ProF* or O*I wit0 -ersion 5.5"t0e only means of p

a cursor -ariale to a P(/SQ( loc@ is -ia ind -ariale or a procedure parameter.

3.  Can cursor %ar#a&!es &e store" #n PL/S0L ta&!es.$ *es ho(.$ not (h*.

No" a cursor -ariale points a row w0ic0 cannot e stored in a twoBdimensional P(/SQ( tale

3.  D#$$erence &et(een proce"ure an" $unct#on.

8unctions are named P(/SQ( loc@s t0at return a -alue and can e called wit0 arguprocedure a named loc@ t0at can e called wit0 parameter. A procedure all is a P(/SQ( stat

y itself" w0ile a 8unction call is called as part of an e1pression.

34.  What are "#$$erent 5o"es o$ para5eters use" #n $unct#ons an" proce"ures.

.%

'&T

.%'&T

)6.  What #s "#$$erence &et(een a $or5a! an" an actua! para5eter

0e -ariales declared in t0e procedure and w0ic0 are passed as arguments are called

actual" t0e parameters in t0e procedure declaration. Actual parameters contain t0e

-alues t0at are passed to a procedure and recei-e results. 8ormal parameters are t0e

place0olders for t0e -alues of actual parameters

Page 45: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 45/63

 

)1.  Can the "e$au!t %a!ues &e ass#ne" to actua! para5eters.

Ces

)2.  Can a $unct#on ta7e OUT para5eters.$ not (h*.

No.A function 0as to return a -alue"an OU parameter cannot return a -alue.

)3.  What #s s*nta8 $or "ropp#n a proce"ure an" a $unct#on .Are these operposs#&!e.

,rop Procedure procedureHname

,rop 8unction functionHname

)).  What are ORACLE PRECO9PLERS.

Using O'A*(& P'&*OMPI(&'S" SQ( statements and P(/SQ( loc@s can e contained

inside 6$( programs written in *" *" *O3O(" PAS*A(" 8O''ON"P(/4 AN, A,A.

0e PreBcompilers are @nown as ProF*" ProF*ool"...

0is form of P(/SQ( is @nown as emedded pl/sql"t0e language in w0ic0 pl/sql is

emedded is @nown as t0e 0ost language.

Page 46: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 46/63

 

0e preBcompiler translates t0e emedded SQ( and pl/sql statements into calls to t0e

PreBcompiler runtime lirary. 0e output must e compiled and lin@ed wit0 t0is lirary to

creator an e1ecutale.

)+.  What #s OC. What are #ts uses.

Oracle *all Interface is a met0od of accessing dataase

from a 6$( program. UsesBBNo preBcompiler is required" P(/SQ( loc@s are e1ecuted li@e

ot0er ,M(

statements.

0e O*I lirary pro-ides

Bfunctions to parse SQ( statements

Bind input -ariales

Bind output -ariales

Be1ecute statements

Bfetc0 t0e results

)-.  D#$$erence &et(een "ata&ase tr#ers an" $or5 tr#ers.

a"  ata base trigger!B/" fires when a 0L operation is performed on a data base table. 1orm trigg1ires when user presses a key or navigates between fields on the screen

Page 47: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 47/63

 

b"  'an be row level or statement level 2o distinction between row level and statement level.

c"  'an manipulate data stored in Oracle tables via 34L 'an manipulate data in Oracle tables as well a

-ariales in forms.

d"  'an be fired from any session e5ecuting the triggering 0L statements. 'an be fired only from ththat define the trigger.

e"  'an cause other database triggers to fire. 'an cause other database triggers to fire& but not othetriggers.

).  What #s an UTL:FLE. What are "#$$erent proce"ures an" $unct#ons asso(#th #t.

U(H8I(& is a pac@age t0at adds t0e aility to read and write to operating system files

Procedures associated wit0 it are 8*(OS&" 8*(OS&HA(( and ; procedures to output

data to a file PU" PUH(IN&" N&)H(IN&" PU8" 88(US+.PU" 88(US+.PUH(IN&"88(US+.N&)H8unctions associated wit0 it are 8OP&N" ISOP&N.

$3.  Can :ou use a co44it state4ent wit&in a database trigger.

2o

)4.  What #s the 5a8#5u5 &u$$er s#;e that can &e spec#$#e" us#n the D<9S:OUTPUT.E$unct#on

4"JJJ"JJJ

Page 48: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 48/63

Important 7uestions in Lracle, De%eloper K(000$Form . andReports (.&

Oracle

%) 0hat are the Bac9 !round rocesses in Oracle and $hat are the5&M

-here are basically 4 Jrocesses but in a general system 'e need to mention the "irst "i%e bac*ground processes.-hey do the house *eeping acti%ities "or the Lracle and are common inany system.-he %arious bac*ground processes in oracle area& Data Base 5riter$DB5R& :: Data Base 5riter 5rites Modi"ied bloc*s "rom Database bu""ercache to Data Files.-his is re@uired since the data is not 'ritten 'hene%er a transaction iscommited. b&/og5riter$/5R& :: /og5riter 'rites the redo log entries to dis*. Redo /og data isgenerated in redo log bu""er o" S!. !s transaction commits and log bu""er "ills, /5R 'riteslog entries into a online redo log "ile.

c& System Monitor$SML;& :: -he System Monitor per"orms instance reco%ery at instancestartup.-his is use"ul "or reco%ery "rom system "ailured&Jrocess Monitor$JML;& :: -he Jrocess Monitor pe"orms process reco%ery 'hen user Jrocess"ails. Jmon Clears and Frees resources that process 'as using.e& Chec*Joint$CZJ-& :: !t Speci"ied times, all modi"ied database bu""ers in S! are 'ritten todata "iles by DB5R at Chec*points and Epdating all data "iles and control "iles o" database toindicate the most recent chec*point

Page 49: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 49/63

"&!rchie%es$!RCQ& :: -he !rchi%er copies online redo log "iles to archi%al storal 'hen they are busy.g& Reco%eror $R)CL& :: -he Reco%eror is used to resol%e the distributed transaction in net'or* h& Dispatcher $Dnnn& :: -he Dispatcher is use"ul in Multi -hreaded !rchitecturei& /c*n :: 5e can ha%e upto 0 loc* processes "or inter instance loc*ing in parallel s@l.

<) 1o$ man5 t5es of S#l Statements are there in OracleM

 -here are basically 1 types o" s@l statments.-hey area& Data De"ination /anguage$DD/& :: -he DD/ statments de"ine and maintain obHects and dropobHects. b& Data Manipulation /anguage$DM/& :: -he DM/ statments manipulate database data.c& -ransaction Control Statements :: Manage change by DM/d& Session Control Statements :: Esed to control the properties o" current session enabling anddisabling roles and changing .e.g :: !lter Statements,Set Rolee& System Control Statements :: Change Jroperties o" Lracle Instance .e.g:: !lter System

"& )mbedded S@l :: Incorporate DD/,DM/ and -.C.S in Jrogramming /anguage.e.g:: Esingthe S@l Statements in languages such as ?C?, Lpen,Fetch, e#ecute and close

+& 0hat is a 'ransaction in OracleM

! transaction is a /ogical unit o" 'or* that compromises one or more S7/ Statements e#ecuted by a single Eser. !ccording to !;SI, a transaction begins 'ith "irst e#ecutable statment and ends'hen it is e#plicitly commited or rolled bac*.

G) 3e5 0ords sed in OracleM

-he Zey 'ords that are used in Lracle are ::a& Commiting :: ! transaction is said to be committed 'hen the transaction ma*es permanentchanges resulting "rom the S7/ statements. b& Rollbac* :: ! transaction that retracts any o" the changes resulting "rom S7/ statementsin -ransaction. c& Sa%e Joint :: For long transactions that contain many S7/ statements, intermediatemar*ers or sa%epoints are declared. Sa%epoints can be used to di%ide a transactino into smaller points.d& Rolling For'ard :: Jrocess o" applying redo log during reco%ery is called rolling "or'ard. e& Cursor :: ! cursor is a handle $ name or a pointer& "or the memory associated 'ith aspeci"ic stament. ! cursor is basically an area allocated by Lracle "or e#ecuting the S@lStatement. Lracle uses an implicit cursor statement "or Single ro' @uery and Eses )#plcit cursor "or a multi ro' @uery."& System lobal !rea$S!& :: -he S! is a shared memory region allocated by the Lracle thatcontains Data and control in"ormation "or one Lracle Instance.It consists o" Database Bu""erCache and Redo log Bu""er.g& Jrogram lobal !rea $J!& :: -he J! is a memory bu""er that contains data and controlin"ormation "or ser%er process.g& Database Bu""er Cache :: Databese Bu""er o" S! stores the most recently used bloc*s o"datatbase data.-he set o" database bu""ers in an instance is called Database Bu""er Cache.h& Redo log Bu""er :: Redo log Bu""er o" S! stores all the redo log entries.

Page 50: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 50/63

i& Redo /og Files :: Redo log "iles are set o" "iles that protect altered database data in memorythat has not been 'ritten to Data Files. -hey are basically used "or bac*up 'hen a databasecrashes. H& Jrocess :: ! Jrocess is a ?thread o" control? or mechansim in Lperating System thate#ecutes series o" steps.

) 0hat are rocedure,functions and ac9a!esM

 Jrocedures and "unctions consist o" set o" J/KS7/ statements that are grouped together as aunit to sol%e a speci"ic problem or per"orm set o" related tas*s. Jrocedures do not Return %alues 'hile Functions return Lne OalueJac*ages :: Jac*ages Jro%ide a method o" encapsulating and storing related procedures,"unctions, %ariables and other Jac*age Contents

) 0hat are Database 'ri!!ers and Stored roceduresM

Database -riggers$D-& :: Database -riggers are Jrocedures that are automatically e#ecuted as aresult o" insert in, update to, or delete "rom table. D- ha%e the %alues old and ne' to denote the

old %alue in the table be"ore it is deleted and the ne' indicated the ne' %alue that 'ill be used.D- are use"ul "or implementing comple# business rules 'hich cannot be en"orced using theintegrity rules.5e can ha%e the trigger as Be"ore trigger or !"ter -rigger and at Statement or Ro'le%el.e.g:: operations insert,update ,delete + be"ore ,a"ter +( ! total o" 1 combinatons !tstatment le%el$once "or the trigger& or ro' le%el$ "or e%ery e#ecution & 1 ( ! total o" (.-hus a total o" ( combinations are there and the restriction o" usage o" ( triggers has beenli"ted "rom Lracle 2.+ Ln'ards.Stored Jrocedures :: Stored Jrocedures are Jrocedures that are stored in Compiled "orm in thedatabase.-he ad%antage o" using the stored procedures is that many users can use the same procedure in compiled and ready to use "ormat.

H) 1o$ man5 *nte!rit5 Rules are there and $hat are the5M

-here are -hree Integrity Rules. -hey are as "ollo's ::a& )ntity Integrity Rule :: -he )ntity Integrity Rule en"orces that the Jrimary *ey cannot be ;ull b& Foreign Zey Integrity Rule :: -he FZIR denotes that the relationship bet'een the "oreign *eyand the primary *ey has to be en"orced.5hen there is data in Child -ables the Master tablescannot be deleted.c& Business Integrity Rules :: -he -hird Intigrity rule is about the comple# business processes'hich cannot be implemented by the abo%e ( rules.

I) 0hat are the +arious 2aster and Detail Relation shis&M

-he %arious Master and Detail Relationship area& ;onIsolated :: -he Master cannot be deleted 'hen a child is e#isiting b& Isolated:: -he Master can be deleted 'hen the child is e#isitingc& Cascading :: -he child gets deleted 'hen the Master is deleted.

J) 0hat are the +arious Bloc9 Coordination roertiesM

-he %arious Bloc* Coordination Jroperties area& Immediate : De"ault Setting. -he Detail records are sho'n 'hen the Master Record aresho'n.

Page 51: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 51/63

 b& De""ered 'ith !uto 7uery : Lracle Forms de"er "etching the detail records until the operatorna%igates to the detail bloc*.c& De""ered 'ith ;o !uto 7uery : -he operator must na%igate to the detail bloc* and e#plicitlye#ecute a @uery

%7) 0hat are the Different Otimisation 'echni#uesM-he Oarious Lptimisation techni@ues are :a& )#ecute Jlan :: 'e can see the plan o" the @uery and change it accordingly based on theinde#es b& Lptimier9hint ::set9item9property$?DeptBloc*?,LJ-IMI[)R9QI;-,?FIRS-9RL5S?&Select KG First9Ro's K Deptno,Dname,/oc,Ro'id "rom dept'here $Deptno 8 (&c& Lptimie9S@l ::By setting the Lptimie9S@l = ;o, Lracle Forms assigns a single cursor "or all S7/statements.-his slo' do'ns the processing because "or e%ertime the S7/ must be parsed

'hen%er they are e#ecuted."run module = my9"irst"orm userid = scottKtiger optimie9s@l = ;od& Lptimie9-p :: By setting the Lptimie9-p= ;o, Lracle Forms assigns seperate cursor only "or each @ueryS)/)C- statement. !ll other S7/ statements reuse the cursor."run module = my9"irst"orm userid = scottKtiger optimie9-p = ;o

& Qo' do u implement the I" statement in the Select Statement& 5e can implement the i" statement in the select statement by using the Decode statement.e.g select D)CLD) $)MJ9C!-,??,?First?,?(?,?Second?;ull&Qere the ;ull is the else statement 'here null is done .

(&Qo' many types o" )#ceptions are there(& -here are ( types o" e#ceptions. -hey area& System )#ceptionse.g. 5hen no9data9"ound, 5hen too9many9ro's b& Eser De"ined )#ceptionse.g. My9e#ception e#ception5hen My9e#ception then

+& 5hat are the inline and the precompiler directi%es+& -he inline and precompiler directi%es detect the %alues directly

& Qo' do you use the same lo% "or ( columns& 5e can use the same lo% "or ( columns by passing the return %alues in global %alues andusing the global %alues in the code

& Qo' many minimum groups are re@uired "or a matri# report& -he minimum number o" groups in matri# report are

Page 52: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 52/63

1& 5hat is the di""erence bet'een static and dynamic lo%1& -he static lo% contains the predetermined %alues 'hile the dynamic lo% contains %alues thatcome at run time

2& 5hat are snap shots and %ie's

2& Snapshots are mirror or replicas o" tables. Oie's are built using the columns "rom one ormore tables. -he Single -able Oie' can be updated but the %ie' 'ith multi table cannot beupdated

3& 5hat are the LLJS concepts in Lracle.3& Lracle does implement the LLJS concepts. -he best e#ample is the Jroperty Classes. 5ecan categorise the properties by setting the %isual attributes and then attach the property classes"or theobHects. LLJS supports the concepts o" obHects and classes and 'e can consider the peropertyclasses as classes and the items as obHects

4& 5hat is the di""erence bet'een candidate *ey, uni@ue *ey and primary *ey4& Candidate *eys are the columns in the table that could be the primary *eys and the primary*eyis the *ey that has been selected to identi"y the ro's. Eni@ue *ey is also use"ul "or identi"ying thedistinct ro's in the table.

(0&5hat is concurrency(0& Cuncurrency is allo'ing simultaneous access o" same data by di""erent users. /oc*s use"ul"or accesing the database area& )#clusi%e-he e#clusi%e loc* is use"ul "or loc*ing the ro' 'hen an insert,update or delete is beingdone.-his loc* should not be applied 'hen 'e do only select "rom the ro'. b& Share loc* 5e can do the table as Share9/oc* as many share9loc*s can be put on the same resource.

(& Jre%ileges and rants(& Jre%ileges are the right to e#ecute a particulare type o" S7/ statements.e.g :: Right to Connect, Right to create, Right to resourcerants are gi%en to the obHects so that the obHect might be accessed accordingly.-he grant has to begi%en by the o'ner o" the obHect.

((&-able Space,Data Files,Jarameter File, Control Files((&-able Space :: -he table space is use"ul "or storing the data in the database.5hen a databaseis created t'o table spaces are created.a& System -able space :: -his data "ile stores all the tables related to the system and dba tables b& Eser -able space :: -his data "ile stores all the user related tables5e should ha%e seperate table spaces "or storing the tables and inde#es so that the access is "ast.Data Files :: )%ery Lracle Data Base has one or more physical data "iles.-hey store the data "orthe database.)%ery data"ile is associated 'ith only one database.Lnce the Data "ile is created the

Page 53: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 53/63

sie cannot change.-o increase the sie o" the database to store more data 'e ha%e to add data"ile.Jarameter Files :: Jarameter "ile is needed to start an instance.! parameter "ile contains the listo" instance con"iguration parameters e.g.::db9bloc*9bu""ers = 00

db9name = LR!2db9domain = u.s.acme langControl Files :: Control "iles record the physical structure o" the data "iles and redo log "iles-hey contain the Db name, name and location o" dbs, data "iles ,redo log "iles and time stamp.

(+& Jhysical Storage o" the Data(+& -he "inest le%el o" granularity o" the data base are the data bloc*s.Data Bloc* :: Lne Data Bloc* correspond to speci"ic number o" physical database space)#tent :: )#tent is the number o" speci"ic number o" contigious data bloc*s.Segments :: Set o" )#tents allocated "or )#tents. -here are three types o" Segmentsa& Data Segment :: ;on Clustered -able has data segment data o" e%ery table is stored in

cluster data segment b& Inde# Segment :: )ach Inde# has inde# segment that stores datac& Roll Bac* Segment :: -emporarily store ?undo? in"ormation

(& 5hat are the Jct Free and Jct Esed(& Jct Free is used to denote the percentage o" the "ree space that is to be le"t 'hen creating atable. Similarly Jct Esed is used to denote the percentage o" the used space that is to be used'hen creating a tableeg.:: Jct"ree (0, Jctused 0

(& 5hat is Ro' Chaining(& -he data o" a ro' in a table may not be able to "it the same data bloc*.Data "or ro' is storedin a chain o" data bloc*s .

(1& 5hat is a ( Jhase Commit(1& -'o Jhase commit is used in distributed data base systems. -his is use"ul to maintain theintegrity o" the database so that all the users see the same %alues. It contains DM/ statements orRemote Jrocedural calls that re"erence a remote obHect. -here are basically ( phases in a ( phasecommit.a& Jrepare Jhase :: lobal coordinator as*s participants to prepare b& Commit Jhase :: Commit all participants to coordinator to Jrepared, Read only or abortReply

(2& 5hat is the di""erence bet'een deleting and truncating o" tables(2& Deleting a table 'ill not remo%e the ro's "rom the table but entry is there in the databasedictionary and it can be retrie%ed But truncating a table deletes it completely and it cannot beretrie%ed.

(3& 5hat are mutating tables

Page 54: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 54/63

(3& 5hen a table is in state o" transition it is said to be mutating. eg :: I" a ro' has been deletedthen the table is said to be mutating and no operations can be done on the table e#cept select.

(4& 5hat are Codd Rules(4& Codd Rules describe the ideal nature o" a RDBMS. ;o RDBMS satis"ies all the ( codd

rules and Lracle Satis"ies o" the ( rules and is the only Rdbms to satis"y the ma#imumnumber o" rules.

+0& 5hat is ;ormalisation+0& ;ormalisation is the process o" organising the tables to remo%e the redundancy.-here aremainly ;ormalisation rules.a& ;ormal Form :: ! table is said to be in st ;ormal Form 'hen the attributes are atomic b& ( ;ormal Form :: ! table is said to be in (nd ;ormal Form 'hen all the candidate *eys aredependant on the primary *eyc& +rd ;ormal Form :: ! table is said to be third ;ormal "orm 'hen it is not dependanttransiti%ely

+& 5hat is the Di""erence bet'een a post @uery and a pre @uery+& ! post @uery 'ill "ire "or e%ery ro' that is "etched but the pre @uery 'ill "ire only once.

+(& Deleting the Duplicate ro's in the table+(& 5e can delete the duplicate ro's in the table by using the Ro'id

++& Can E disable database trigger] Qo'] ++& Tes. 5ith respect to table  !/-)R -!B/) -!B/)  P DIS!B/) all9trigger +& 5hat is pseudo columns ] ;ame them]

 +& ! pseudocolumn beha%es li*e a table column, but is not actuallystored in the table. Tou can select "rom pseudocolumns, but youcannot insert, update, or delete their %alues. -his sectiondescribes these pseudocolumns: CERRO!/ ;)^-O!/ /)O)/ RL5ID RL5;EM

+& Qo' many columns can table ha%e]  -he number o" columns in a table can range "rom to (.

+1& Is space ac@uired in bloc*s or e#tents ]

  In e#tents .

Page 55: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 55/63

+2& 'hat is clustered inde#]  In an inde#ed cluster, ro's are stored together based on their cluster *ey %alues .  Can not applied "or Q!SQ.

+3& 'hat are the datatypes supported By oracle $I;-)R;!/&]  Oarchar(, ;umber,Char , M/S/!B)/.

+4 & 5hat are attributes o" cursor]  <FLE;D , <;L-FLE;D , <ISLJ);,<RL5CLE;-

0& Can you use select in FRLM clause o" S7/ select ]  Tes.

/orms G& .uestions

& 5hich trigger are created 'hen master 6detail rela]& master delete property

;L;6ISL/!-)D $de"ault&

a& on chec* delete master  b& on clear detailsc& on populate details

  ISL/!-)D

a& on clear details b& on populate details

C!SC!D)

a& per6delete b& on clear detailsc& on populate details

(& 'hich system %ariables can be set by users](&STS-)M.M)SS!)9/)O)/

Page 56: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 56/63

STS-)M.D!-)9-QR)SQL/DSTS-)M.)FF)C-IO)9D!-)STS-)M.SEJJR)SS95LRZI;

+& 5hat are obHect group]

+&!n obHect group is a container "or a group o" obHects. Tou de"ine an obHect group 'hen you 'ant to pac*age related obHects so you can copy or re"erence them in another module.

& 5hat are re"erenced obHects]&Re"erencing allo's you to create obHects that inherit their "unctionality and appearance "rom otherobHects.Re"erencing an obHect is similar to copying an obHect, e#cept that the resulting re"erence obHect maintainsa lin* to its source obHect. ! re"erence obHect automatically inherits any changes that ha%e been made to

thesource obHect 'hen you open or regenerate the module that contains the re"erence obHect.

& Can you store obHects in library]&Re"erencing allo's you to create obHects that inherit their "unctionality and appearance "rom otherobHects. Re"erencing an obHect is similar to copying an obHect, e#cept that the resulting re"erenceobHect maintains a lin* to its source obHect. ! re"erence obHect automatically inherits any changes thatha%e been made to the source obHect 'hen you open or regenerate the module that contains there"erence obHect.

1& Is "orms . obHect oriented tool ] 'hy]1&yes , partially. & JRLJ)R-T C/!SS 6 inheritance property  (& LO)R/L!DI; : procedures and "unctions.

2& Can you issue DD/ in "orms]2&yes, but you ha%e to use FLRMS9DD/.Re"erencing allo's you to create obHects that inherit their "unctionality and appearance "rom otherobHects. Re"erencing an obHect is similar to copying an obHect, e#cept that the resulting re"erence obHectmaintains a lin* to its source obHect. ! re"erence obHect automatically inherits any changes that ha%e been made to the source obHect 'hen you open or regenerate the module that contains the re"erenceobHect.!ny string e#pression up to +(Z:_a literal_ an e#pression or a %ariable representing the te#t o" a bloc* o" dynamically created J/KS7/ code

Page 57: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 57/63

_ a DM/ statement or_ a DD/ statement

Restrictions:-he statement you pass to FLRMS9DD/ may not contain bind %ariable re"erences in the string, but the

%alues o" bind %ariables can be concatenated into the string be"ore passing the result to FLRMS9DD/.

3& 5hat is S)CER) property]3&6 Qides characters that the operator types into the te#t item. -his setting is typically used "or  pass'ord protection.

4 & 5hat are the types o" triggers and ho' the se@uence o" "iring in te#t item4&-riggers can be classi"ied as Zey -riggers, Mouse -riggers ,;a%igational -riggers.Zey -riggers :: Zey -riggers are "ired as a result o" Zey action.e.g :: Zey6ne#t6"ield, Zey6up,Zey6Do'n

Mouse -riggers :: Mouse -riggers are "ired as a result o" the mouse na%igation.e.g. 5hen6mouse6button6 presed,'hen6mouse6doubleclic*ed,etc ;a%igational -riggers :: -hese -riggers are "ired as a result o" ;a%igation. ).g : Jost6-e#t6item,Jre6te#t6item.5e also ha%e e%ent triggers li*e 'hen ne'6"orm6instance and 'hen6ne'6bloc*6instance.5e cannot call restricted procedures li*e go9to$my9bloc*."irst9item& in the ;a%igational triggersBut can use them in the Zey6ne#t6item.-he Di""erence bet'een Zey6ne#t and Jost6-e#t is an %ery important @uestion. -he *ey6ne#t is "ired as aresult o" the *ey action 'hile the post te#t is "ired as a result o" the mouse mo%ement. Zey ne#t 'ill not"ire unless there is a *ey e%ent.-he se@uence o" "iring in a te#t item are as "ollo's ::  a& pre 6 te#t  b& 'hen ne' item

c& *ey6ne#t  d& 'hen %alidate

e& post te#t

0 & Can you store pictures in database] Qo']0&Tes , in long Ra' datatype.

& 5hat are property classes ] Can property classes ha%e trigger]& Jroperty class inheritance is a po'er"ul "eature that allo's you to @uic*ly de"ine obHects thatcon"orm toyour o'n inter"ace and "unctionality standards. Jroperty classes also allo' you to ma*e global changestoapplications @uic*ly. By simply changing the de"inition o" a property class, you can change thede"initiono" all obHects that inherit properties "rom that class.Tes . !ll type o" triggers .

Page 58: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 58/63

( a& I" you ha%e property class attached to an item and you ha%e same trigger 'ritten "or the item .  5hich 'ill "ire "irst]  (&Item le%el trigger "ires , I" item le%el trigger "ires, property le%el trigger 'on?t "ire. -riggers at thelo'est le%el are al'ays gi%en the "irst pre"erence. -he item le%el trigger "ires "irst and then the bloc* andthen the Form le%el trigger.

 +& 5hat are record groups ] Can record groups created at run6time]+&! record group is an internal Lracle Forms data structure that has a columnKro' "rame'or* similar toadatabase table. Qo'e%er, unli*e database tables, record groups are separate obHects that belong to the"orm module in 'hich they are de"ined. ! record group can ha%e an unlimited number o" columns o"typeCQ!R, /L;, ;EMB)R, or D!-) pro%ided that the total number o" columns does not e#ceed 1Z.Record group column names cannot e#ceed +0 characters.Jrogrammatically, record groups can be used 'hene%er the "unctionality o""ered by a t'o6dimensionalarray o" multiple data types is desirable.

-TJ)S LF R)CLRD RLEJ:7uery Record roup ! @uery record group is a record group that has an associated S)/)C- statement.-he columns in a @uery record group deri%e their de"ault names, data types, and lengths "rom the

database columns re"erenced in the S)/)C- statement. -he records in a @uery record group are thero's retrie%ed by the @uery associated 'ith that record group. ;on6@uery Record roup ! non6@uery record group is a group that does not ha%e an associated@uery, but 'hose structure and %alues can be modi"ied programmatically at runtime.Static Record roup ! static record group is not associated 'ith a @uery rather, you de"ine itsstructure and ro' %alues at design time, and they remain "i#ed at runtime.

& 5hat are !/)R-]&!n !/)R- is a modal 'indo' that displays a message noti"iying operator o" some application

condition.

& Can a button ha%e icon and lable at the same time ]& 6;L

1& 5hat is mouse na%igate property o" button]1&5hen Mouse ;a%igate is -rue $the de"ault&, Lracle Forms per"orms standard na%igation to mo%e the"ocusto the item 'hen the operator acti%ates the item 'ith the mouse.

5hen Mouse ;a%igate is set to False, Lracle Forms does not per"orm na%igation $and the resulting%alidation& to mo%e to the item 'hen an operator acti%ates the item 'ith the mouse.

2& 5hat is FLRMS9MDI95I;DL5] 2& "orms run inside the MDI application 'indo'. -his property is use"ul "or calling a "orm "romanother one.

Page 59: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 59/63

3& 5hat are timers ] 'hen 'hen6timer6e#pired does not "ire] 3& -he 5hen6-imer6)#pired trigger can not "ire during trigger, na%igation, or transaction processing.

4 & Can obHect group ha%e a bloc*]

 4&Tes , obHect group can ha%e bloc* as 'ell as program units.

(0& Qo' many types o" can%ases are there.(0&-here are ( types o" can%ases called as Content and Stac* Can%as. Content can%as is the de"ault andthe one that is used mostly "or gi%ing the base e""ect. Its li*e a plate on 'hich 'e add items and stac*edcan%as is used "or gi%ing + dimensional e""ect. 

-he "ollo'ing @uestions might not be as*ed in an !%erage Inter%ie' and could be as*ed 'henthe Inter%ie'er 'ants to trouble u and go deepppppppppppppNNQe cannot go "urtherN..

& 5hat are user6e#its]& It in%o*es +/ programs.

(& Can you pass %alues to6and6"ro "rom "oreign "unction ] ho' ](& Tes . Tou obtain a return %alue "rom a "oreign "unction by assigning the return %alue to an LracleForms%ariable or item. Ma*e sure that the Lracle Forms %ariable or item is the same data type as the return%alue"rom the "oreign "unction.!"ter assigning an Lracle Forms %ariable or item %alue to a J/KS7/ %ariable, pass the J/KS7/ %ariableasa parameter %alue in the J/KS7/ inter"ace o" the "oreign "unction. -he J/KS7/ %ariable that is passedasa parameter must be a %alid J/KS7/ data type it must also be the appropriate parameter type as de"inedin the J/KS7/ inter"ace.

+& 5hat is I!J^-B structure ]+& -he entries o" Jro C and user e#its and the "orm 'hich simulate the proc or user9e#it are stored inI!J^-B table in dKb.

& Can you call 5I;6SDZ thruo? user e#its]& T)S.

& Does user e#its supports D// on MS5I;DL5S ] & T)S .

1& 5hat is path setting "or D//]

Page 60: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 60/63

1& Ma*e sure you include the name o" the D// in the FLRMS9ES)R)^I- %ariable o" theLR!C/).I;I "ile, or rename the D// to F^-B.D//. I" you rename the D// to F^-B.D//,replace the e#isting F^-B.D// in the `LR!5I;`BI; directory 'ith the ne' F^-B.D//.

 2& Qo' is mapping o" name o" D// and "unction done]

2& -he dll can be created using the Oisual CGG K Oisual Basic -ools and then the dll is put in the path that is de"ined the registery.

3& 'hat is precompiler]3& It is similar to C precompiler directi%es.

 4& Can you connect to non 6 oracle datasource ] Qo']4& Tes .

0 & 'hat are *ey6mode and loc*ing mode properties] le%el ]0& Zey Mode : Speci"ies ho' oracle "orms uni@uely identi"ies ro's in the database.-his is property

includes"or application that 'ill run against ;L;6LR!C/) datasources .Zey setting uni@ue $de"ault.&

dateablen6updateable.

/oc*ing mode :Speci"ies 'hen Lracle Forms should attempt to obtain database loc*s on ro's that correspond to @ueriedrecords in the "orm.a& immediate b& delayed

& 5hat are sa%epoint mode and cursor mode properties ] le%el]& Speci"ies 'hether Lracle Forms should issue sa%epoints during a session. -his property is included primarily "or applications that 'ill run against non6LR!C/) data sources. For applications that 'illrun against LR!C/), use the de"ault setting.Cursor mode 6 de"ine cursur state across transactionLpenKclose.

(& Can you replace de"ault "orm processing ] Qo' ]

+& 5hat is transactional trigger property]+& Identi"ies a bloc* as transactional control bloc*. i.e. non 6 database bloc* that oracle "orms shouldmanage as transactional bloc*.$;L;6LR!C/) datasource& de"ault 6 F!/S).

& 5hat is L/) automation ]& L/) automation allo's an L/) ser%er application to e#pose a set o" commands and "unctions thatcan bein%o*ed "rom an L/) container application. L/) automation pro%ides a 'ay "or an L/) containerapplication to use the "eatures o" an L/) ser%er application to manipulate an L/) obHect "rom the L/)container en%ironment. $FLRMS9L/)&

Page 61: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 61/63

& 5hat does in%o*e built6in do]& -his procedure in%o*es a method.Synta#:JRLC)DER) L/)(.I;OLZ)

  $obHect obH9type,  method O!RCQ!R(,  list list9type := 0&Jarameters:obHect Is an L/)( !utomation LbHect.method Is a method $procedure& o" the L/)( obHect.list Is the name o" an argument list assigned to the L/)(.CR)!-)9!R/IS- "unction.

1& 5hat are LJ);9FLRM,C!//9FLRM,;)59FLRM] di""]1& C!//9FLRM : It calls the other "orm. but parent remains acti%e, 'hen called "orm completes theoperation , it releases loc* and control goes bac* to the calling "orm.

5hen you call a "orm, Lracle Forms issues a sa%epoint "or the called "orm. I" the C/)!R9FLRM"unctioncauses a rollbac* 'hen the called "orm is current, Lracle Forms rolls bac* uncommitted changes to thissa%epoint.LJ);9FLRM : 5hen you call a "orm, Lracle Forms issues a sa%epoint "or the called "orm. I" theC/)!R9FLRM "unction causes a rollbac* 'hen the called "orm is current, Lracle Forms rolls bac*uncommitted changes to this sa%epoint. ;)59FLRM : )#its the current "orm and enters the indicated "orm. -he calling "orm is terminated asthe parent "orm. I" the calling "orm had been called by a higher "orm, Lracle Forms *eeps the highercall acti%e and treats it as a call to the ne' "orm. Lracle Forms releases memory $such as database cursors&that the terminated "orm 'as using.Lracle Forms runs the ne' "orm 'ith the same Run"orm options as the parent "orm. I" the parent "orm'asa called "orm, Lracle Forms runs the ne' "orm 'ith the same options as the parent "orm.

2 & 5hat is call "orm stac*]2& 5hen successi%e "orms are loaded %ia the C!//9FLRM procedure, the resulting module hierarchyis *no'n as the call "orm stac*.

3& Can u port applictions across the plat"orms] ho']3& Tes 'e can port applications across plat"orms.Consider the "orm de%eloped in a 'indo'ssystem.-he "orm 'ould be generated in uni# system by using "gen my9"orm."mb scottKtiger 

EI

& 5hat is a %isual attribute]

Page 62: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 62/63

& Oisual attributes are the "ont, color, and pattern properties that you set "or "orm and menu obHects thatappear in your application?s inter"ace.

(& Di"". bet'een O!- and Jroperty Class] imp(&;amed %isual attributes de"ine only "ont, color, and pattern attributes property classes can contain

these and any other properties.Tou can change the appearance o" obHects at runtime by changing the named %isual attribute programmatically property class assignment cannot be changed programmatically.5hen an obHect is inheriting "rom both a property class and a named %isual attribute, the named %isualattribute settings ta*e precedence, and any %isual attribute properties in the class are ignored.

+ & 5hich trigger related to mouse]+& 5hen6Mouse6Clic*   5hen6Mouse6DoubleClic*   5hen6Mouse6Do'n  5hen6Mouse6)nter 

  5hen6Mouse6/ea%e  5hen6Mouse6Mo%e  5hen6Mouse6Ep

& 5hat is Current record attribute property]& Speci"ies the named %isual attribute used 'hen an item is part o" the current record.Current Record !ttribute is "re@uently used at the bloc* le%el to display the current ro' in a multi6recordI" you de"ine an item6le%el Current Record !ttribute, you can display a pre6determined item in a specialcolor'hen it is part o" the current record, but you cannot dynamically highlight the current item, as the input"ocus changes.

& Can u change O!- at run time]& Tes. Tou can programmatically change an obHect?s named %isual attribute setting to change the "ont,color,and pattern o" the obHect at runtime.

1& Can u set de"ault "ont in "orms]1& Tes. Change 'indo's registry$regedit&. Set "orm9"ont to the desired "ont.

2& Can u ha%e L/) obHects in "orms]2& Tes.

3& Can u ha%e OB^ and LC^ controls in "orms ]3& Tes.

4& 5hat r the types o" 'indo's $5indo' style&]4& Speci"ies 'hether the 'indo' is a Document 'indo' or a Dialog 'indo'.0& 5hat is L/) !cti%ation style property]0& Speci"ies the e%ent that 'ill acti%ate the L/) containing item.

Page 63: sql

7/18/2019 sql

http://slidepdf.com/reader/full/sql55cf87f655034664618bf35f 63/63

& Can u change the mouse pointer ] Qo']& Tes. Speci"ies the mouse cursor style. Ese this property to dynamically change the shape o" thecursor.

Reorts <&

& Qo' many types o" columns are there and 'hat are they& Formula columns :: For doing mathematical calculations and returning one %alue

Summary Columns :: For doing summary calculations such as summations etc.Jlace holder Columns :: -hese columns are use"ul "or storing the %alue in a %ariable

(& Can u ha%e more than one layout in report(& It is possible to ha%e more than one layout in a report by using the additional layout option

in the layout editor.

+& Can u run the report 'ith out a parameter "orm+& Tes it is possible to run the report 'ithout parameter "orm by setting the J!R!M %alue to

 ;ull

& 5hat is the loc* option in reports layout& By using the loc* option 'e cannot mo%e the "ields in the layout editor outside the "rame.

-his is use"ul "or maintaining the "ields .

& 5hat is Fle#& Fle# is the property o" mo%ing the related "ields together by setting the "le# property on

1& 5hat are the minimum number o" groups re@uired "or a matri# report1& -he minimum o" groups re@uired "or a matri# report are