Suppose that you are a manufacturer of product ABC, which is composed of parts A, B, and C. Each time a new product ABC is created, it must be added to the product inventory, using the PROD_QOH in a table named PRODUCT. Also, each time the product is created, the parts inventory, using PART_QOH in a table named PART, must be reduced by one each of parts A, B, and C. The sample database contents are shown in Table P10.1.
1.Given the preceding information, answer Questions a through e.
a. How many database requests can you identify for an inventory update for both PRODUCT and PART?
b. Using SQL, write each database request you identified in Step a.
c. Write the complete transaction(s).
d. Write the transaction log, using Table 10.1 as your template.
e. Using the transaction log you created in Step d, trace its use in database recovery.
To upload and submit your assignment, click the Choose File button below to find and select your saved document. Make sure that the file is saved with your last name in the file name. (Example: ch10_problem1_Jones.doc)
2.What DBMS component is responsible for concurrency control? How is this feature used to resolve conflicts?
3.ABC Markets sell products to customers. The relational diagram shown in Figure P10.6 represents the main entities for ABC's database. Note the following important characteristics
a.A customer may make many purchases, each one represented by an invoice.
b.The CUS_BALANCE is updated with each credit purchase or payment and represents the amount the customer owes.
c.The CUS_BALANCE is increased (+) with every credit purchase and decreased (–) with every customer payment.
d.The date of last purchase is updated with each new purchase made by the customer.
e.The date of last payment is updated with each new payment made by the customer.
f.An invoice represents a product purchase by a customer.
g.An INVOICE can have many invoice LINEs, one for each product purchased.
h.The INV_TOTAL represents the total cost of the invoice, including taxes.
i.The INV_TERMS can be "30," "60," or "90" (representing the number of days of credit) or "CASH," "CHECK," or "CC."
j.The invoice status can be "OPEN," "PAID," or "CANCEL."
k.A product's quantity on hand (P_QTYOH) is updated (decreased) with each product sale.
l.A customer may make many payments. The payment type (PMT_TYPE) can be one of the following:
m."CASH" for cash payments.
n."CHECK" for check payments.
o."CC" for credit card payments.
p.The payment details (PMT_DETAILS) are used to record data about check or credit card payments:
q.The bank, account number, and check number for check payments.
r.The issuer, credit card number, and expiration date for credit card payments.
Using this database, write the SQL code to represent each of the following transactions. Use BEGIN TRANSACTION and COMMIT to group the SQL statements in logical transactions.
i. On May 11, 2018, customer 10010 makes a credit purchase (30 days) of one unit of product 11QER/31 with a unit price of $110.00; the tax rate is 8 percent. The invoice number is 10983, and this invoice has only one product line.
ii.On June 3, 2018, customer 10010 makes a payment of $100 in cash. The payment ID is 3428
4.Assuming that pessimistic locking with the two-phase locking protocol is being used with row-level lock granularity, create a chronological list of the locking, unlocking, and data manipulation activities that would occur during the complete processing of the transaction described in Problem 6b.
5.Assuming that pessimistic locking is being used but the two-phase locking protocol is not, create a chronological list of the locking, unlocking, and data manipulation activities that would occur during the complete processing of the transaction described in Problem 6a.
6.Assuming that pessimistic locking is being used with the two-phase locking protocol, create a chronological list of the locking, unlocking, and data manipulation activities that would occur during the complete processing of the transaction described in Problem 6a.
7.Suppose that your database system has failed. Describe the database recovery process and the use of deferred-write and write-through techniques
8.Using a simple example, explain the use of binary and shared/exclusive locks in a DBMS.
9.Create a simple transaction log (using the format shown in Table 10.14) to represent the actions of the transactions in Problems 6a and 6b.
10.Assuming that pessimistic locking is being used but the two-phase locking protocol is not, create a chronological list of the locking, unlocking, and data manipulation activities that would occur during the complete processing of the transaction described in Problem 6b.
11.Describe the three most common problems with concurrent transaction execution. Explain how concurrency control can be used to avoid those problems.