Você está na página 1de 4

KRCT-M.E.

CSE 2013-2015 BATCH


CP7211 ADVANCED DATABASE LABORATORY AIM: To learn to work on distrib ted data bases. DISTRIBUTED DATABASE: 1. Consider a distrib ted database !or a bookstore wit" # sites $alled S1% S2% S3 and S#. Consider t"e !ollowin& relations' Books ( )SB*% +ri,ar- A t"or% to+i$% total Sto$k% +ri$e . Book Store (store *o% $it-% state% /i+% in0entor-1al e . Sto$k (store *o% )SB*% 2t- . Total Sto$k is t"e total n ,ber o! books in sto$k and in0entor- 1al e is t"e total in0entor0al e !or t"e store in dollars. Consider t"at Books are !ra&,ented b- +ri$e a,o nts into' 31' Books' +ri$e + to 420 32' Books' +ri$e !ro, 420.01 to 450 33' Books' +ri$e !ro, 450.01 to 4100 3#' Books' +ri$e 4100.01 and abo0e Si,ilarl-% Book Stores are di0ided b- 5)6 $odes into' S1' Bookstore' 5i+ + to 25000 S2' Bookstore' 5i+ 25001 to 50000 S3' Bookstore' 5i+ 50001 to 75000 S#' Bookstore' 5i+ 75001 to 88888 Task' 9rite S2: ; er- !or t"e !ollowin& ALGORITHM: 1. Start t"e +ro&ra,. 2. Create a table Book wit" !ields )SB*% +ri,ar- A t"or% to+i$% total Sto$k% +ri$e. 3. Create a table Bookstore wit" store *o% $it-% state% /i+% in0entor- 1al e. #. Create a table Sto$k store *o% )SB*% 2t-. 5. 3ind Total sto$k and in0entor- 0al e. <. Books are !ra&,ented into 31% 32% 33 and 3# based on +ri$e a,o nt. 7. Bookstores are di0ided into S1%S2%S3 and S#. =. )nsert 0al e into ea$" table 8. 3ind t"e total n ,ber o! books in sto$k w"ere +ri$e is between 415 and 455. 10. >+date t"e book +ri$e o! book *o?123# !ro, 4#5 to 455 at site S3. 11. 3ind total n ,ber o! book at site S2. 12. @is+la- ; er- o t+ t. 13. Sto+ t"e +ro&ra,

KRCT-M.E. CSE 2013-2015 BATCH


1. INSERT AND DISPLAY DETAILS IN EACH TABLE. $reate table books (isbn 0ar$"ar(15.%+ri,ar-a t"or 0ar$"ar(20.%to+i$ 0ar$"ar(20.%totalsto$k n ,eri$(5.%+ri$e n ,eri$(<%2.%+ri,ar- ke-(isbn..A $reate table bookstore(storeBno 0ar$"ar(15.%$it- 0ar$"ar(20.%state n ,eri$(10%2.%in0entor-B0al e n ,eri$(<%2.%+ri,ar- ke-(storeBno..A $reate table sto$k(storeBno ke-(storeBno%isbn..A 0ar$"ar(15.%isbn 0ar$"ar(15.%;t0ar$"ar(20.%/i+

n ,eri$(20.%+ri,ar-

insert into books 0al insert into books 0al insert into books 0al insert into books 0al sele$t E !ro, booksA

es(C1231C%Cwillia,C%Cnetwork se$ rit-C%C5C%C#0C.A es(C1232C%CrobertC%C+ro&ra,,in& lan& a&eC%C=C%C100C.A es(C1233C%Cri$"ardC%Co+eratin& s-ste,sC%C7C%C50C.A es(C123#C%CDe!!re-C%CdatabasesC%C#C%C#5C.A

insert into bookstore 0al es(C1C%Ctri$"-C%Cta,ilnad C%C#0000C%C#50C.A insert into bookstore 0al es(C2C%C$"ennaiC%Cta,ilnad C%C50000C%C500C.A insert into bookstore 0al es(C3C%Ctri0andr ,C%CkeralaC%C<5000C%C=50C.A insert into bookstore 0al es(C#C%C, ,baiC%C,ad"-a +rades"C%C70000C%C<00C.A sele$t E !ro, bookstoreA

KRCT-M.E. CSE 2013-2015 BATCH

insert into sto$k 0al insert into sto$k 0al insert into sto$k 0al insert into sto$k 0al sele$t E !ro, sto$kA

es(C1C%C1231C%C#5C.A es(C2C%C1232C%C55C.A es(C3C%C1233C%C<5C.A es(C#C%C123#C%C85C.A

2. Find th t!t"# n$%& ' !( &!!)* in *t!+) ,h ' -'i+ i* & t, n .1/ "nd .//. sele$t s ,(totalsto$k. !ro, books w"ere +ri$e between 15 and 55A

0. U-d"t th &!!) -'i+ !( &!!) N!11202 ('!% .2/ t! .// "t *it S0. +date books set +ri$e?C55C w"ere )SB*?C123#CA

KRCT-M.E. CSE 2013-2015 BATCH

2. Find t!t"# n$%& ' !( &!!) "t *it S2. sele$t s ,(2t-. !ro, sto$k%bookstore w"ere sto$k.storeBno?Bookstore.storeBno and /i+ between C25001C and C50000CA

Res lt' T" s t"e distrib ted data bases $on$e+ts sin& S2: 2 eries eFe$ ted and 0eri!ied s $$ess! ll-.

Você também pode gostar