Title: Distributed database implementation for bookstore
Consider a distributed database for a bookstore with 3 sites called site1, site2 and site3.
Consider the following relations:
books ( ISBN, Author, Topic, TotalStock, Price )
BookStore (Storeno, City, State, ZipCode, InventoryValue )
Stock (Storeno, ISBN, Qty )
Total Stock is the total number of books in stock.
Now here in this distributed database for bookstore, we have fragmented the books according to the
ISBN numbers into:
F1:books: ISBN from 1001 to 1010
F2:books: ISBN from 1021 to 1030
F3:books: ISBN from 1031 to 1040
Similarly, Book Stores are divided according to their store number into
S1:BookStore: Storeno from 1 to 10
S2:BookStore: Storeno from 11 to 20
S3:BookStore: Storeno from 21 to 30
books
books
BookStore
BookStore site1 site2
site3 Stock
Stock
books BookStore
Stock
Fig. Distributed Database for book store
Now write SQL queries for the following
Procedure:
Creation of database 1: site1
Creation of database 2: site2
Creation of database 3: site3
Now from Site3, we want to check on the total number of books available at each site.
We are on site1 and we want to access the books on site3, site 2. Now it is possible using distributed
database.
From site 2, we want to check the available copies of particular book with ISBN number in the
bookstore. According to the ISBN number in which fragment it belongs, search in the respective
database.
Get the list of all the books available in the bookstore from any site.
Get the list of all the stores from any site.