1. Consider a distributed database for a bookstore with 4 sites called S1, S2, S3 and S4.
Consider the following relations:
Books ( ISBN, primary Author, topic, total Stock, price )
Book Store (store No, city, state, zip, inventoryValue )
Stock (store No, ISBN, Qty )
Total Stock is the total number of books in stock and inventory Value is the total
inventory value for the store in dollars.
Consider that Books are fragmented by price amounts into:
F1: Books: price up to $20
F2: Books: price from $20.01 to $50
F3: Books: price from $50.01 to $100
F4: Books: price $100.01 and above
Similarly, Book Stores are divided by ZIP codes into:
S2: Bookstore: Zip 25001 to 50000
S3: Bookstore: Zip 50001 to 75000
S4: Bookstore: Zip 75001 to 99999
Task: Write SQL query for the following
1. Insert and Display details in each table.
2. Find the total number of books in stock where price is between $15 and $55.
3. Update the book price of book No=1234 from $45 to $55 at site S3.
4. Find total number of book at site S2.
2. Implement deadlock detection algorithm for distributed database using wait-for graph
and test with the following information.
Consider five transactions T1, T2, T3, T4 and T5 with
T1 initiated at site S1 and spawning an agent at site S2
T2 initiated at site S3 and spawning an agent at site S1
T3 initiated at site S1 and spawning an agent at site S3
T4 initiated at site S2 and spawning an agent at site S3
T5 initiated at site S3
The locking information for these transactions is shown in the following table
Transactions Data items locked
by transactions
Data items transaction is
waiting for
Site involved
in operations
T1 X1 X8 S1
T1 X6 X2 S2
T2 X4 X1 S1
T2 X5 - S3
T3 X2 X7 S1
T3 - X3 S3
T4 X7 - S2
T4 X8 X5 S3
T5 X3 X7 S3
Produce local wait for graph for each of the sites and construct global wait for graph and
check for dead lock.