Database Systems: Design, Implementation, & Management
Database Systems: Design, Implementation, & Management
12th Edition
ISBN: 9781305627482
Author: Carlos Coronel, Steven Morris
Publisher: Cengage Learning
Expert Solution & Answer
Book Icon
Chapter 10, Problem 1P

a)

Explanation of Solution

Number of database request identified for an inventory update for both PRODUCT and PART:

The number of database request based on the SQL query of the transaction.

  • If the user gives the query to add the product “ABC” by “1”, reducing each parts “A”, “B”, and “C” individually means, the number transaction request will be “4”.
  • If the user add the product “ABC” by “1”, reducing each parts “A”, “B”, and “C” in a single statement using “OR” condition means, the number transaction request will be “2”.

b)

Explanation of Solution

SQL statement for each database requests that identified in “Step a”:

Four SQL statements:

SQL Query:

UPDATE PRODUCT

    SET PROD_QOH = PROD_QOH + 1

        WHERE PROD_CODE = ‘ABC’

Explanation:

The above SQL query is to update the “PROD_QOH” field using “UPDATE” statement that adds the new product by “1” to “PRODUCT” table where the product code is “ABC”.

SQL Query:

UPDATE PART

    SET PART_QOH = PART_QOH - 1

        WHERE PART_CODE = ‘A’

Explanation:

The above SQL query is to update the “PART_QOH” field using “UPDATE” statement to reduce the parts inventory by “1” from “PART” table where the product code is “A”.

SQL Query:

UPDATE PART

    SET PART_QOH = PART_QOH - 1

        WHERE PART_CODE = ‘B’

Explanation:

The above SQL query is to update the “PART_QOH” field using “UPDATE” statement to reduce the quantity by “1” from “PART” table where the product code is “B”.

SQL Query:

UPDATE PART

    SET PART_QOH = PART_QOH - 1

        WHERE PART_CODE = ‘C’

Explanation:

The above SQL query is to update the “PART_QOH” field using “UPDATE” statement to reduce the parts inventory by “1” from “PART” table where the product code is “C”.

Two SQL statements:

The following SQL UPDATE statement to add the new product by “1” to “PRODUCT” table where the product code is specified as “ABC”.

SQL Query:

UPDATE PRODUCT

    SET PROD_QOH = PROD_QOH + 1

        WHERE PROD_CODE = ‘ABC’

Explanation:

The above SQL query is to update the “PROD_QOH” field using “UPDATE” statement to reduce the parts inventory by “1” from “PRODUCT” table where the product code is “ABC”.

SQL Query:

UPDATE PART

    SET PART_QOH = PART_QOH - 1

WHERE PART_CODE = ‘A’ OR PART_CODE= ‘B’ OR PART_CODE= ‘C’

Explanation:

The above SQL query is to update the “PART_QOH” field using “UPDATE” statement to reduce the parts inventory by “1” from “PART” table where the product code is either “A” or “B” or “C”.

c)

Explanation of Solution

Complete SQL transaction statements:

Four SQL statements:

BEGIN TRANSACTION

UPDATE PRODUCT

  SET PROD_QOH = PROD_QOH + 1

      WHERE PROD_CODE = ‘ABC’

UPDATE PART

  SET PART_QOH = PART_QOH - 1

      WHERE PART_CODE = ‘A’

UPDATE PART

  SET PART_QOH = PART_QOH - 1

      WHERE PART_CODE = ‘B’

UPDATE PART

  SET PART_QOH = PART_QOH - 1

      WHERE PART_CODE = ‘C’

COMMIT;

Explanation:

The above SQL transaction is to update the tables “PRODUCT” and “PART” by adding and removing the value “1” from “PART_QOH” and “PROD_QOH” field.

  • Add the value of “PROD_QOH” field by “1” where “PROD_CODE” is “ABC”.
  • Reduce the value by “1” from “PART_QOH” field in “PART” table where the “PART_CODE” either “A”, “B”, or “C”.

Two SQL statements:

BEGIN TRANSACTION

UPDATE PRODUCT

  SET PROD_QOH = PROD_QOH + 1

      WHERE PROD_CODE = ‘ABC’

UPDATE PART

  SET PART_QOH = PART_QOH - 1

      WHERE PART_CODE = ‘A’ OR

                     PART_CODE = ‘B’ OR

                     PART_CODE = ‘C’

COMMIT;

Explanation:

The above SQL transaction is to update the tables “PRODUCT” and “PART” by adding and removing the value “1” from “PART_QOH” and “PROD_QOH” field.

  • Add the value of “PROD_QOH” field by “1” where “PROD_CODE” is “ABC”.
  • Reduce the value by “1” from “PART_QOH” field in “PART” table where the “PART_CODE” either “A”, “B”, or “C”.

d)

Program Plan Intro

Transaction log:

It is a feature used by the DBMS software to keep track all of the information that contains a description of all database transactions executed by the DBMS. This transaction plays the major role for database maintenance.

d)

Expert Solution
Check Mark

Explanation of Solution

Transaction log for the transaction that was mentioned in subpart “c”:

The product of the ‘ABC’ has a PROD_QOH = 1,205 at beginning of the transaction and that the transaction is specified the addition of one new product.

The PART components “A”, “B” and “C” have a PROD_QOH equal to 567, 98, and 549 respectively.

Trans_

ID

Trans_

NUM

Prev_ptr Next_ptr

Operation

Table

Value_ID

Attribute

Before_

trans

After_

trans

1 T1 NULL 2 START **START TRANSACTION
2 T1 1 3 UPDATE PRODUCT ‘ABC’ PROD_QOH 1025 1026
3 T1 2 4 UPDATE PART ‘A’ PART_QOH 567 566
4 T1 3 5 UPDATE PART ‘B’ PART_QOH 98 97
5 T1 4 6 UPDATE PART ‘C’ PART_QOH 549 548
6 T1 5 NULL COMMIT

** END

TRANSACTION

e)

Explanation of Solution

Trace out of transaction log mentioned in sub part “d”:

The above transaction log has transaction ID(Trans_ID), transaction number(Trans_NUM), and other fields used to recover the transaction.

The trace out of transaction log from beginning of the transaction is as follows:

Trans_ID 1: Beginning of the transaction.

Trans_ID 2: Update the table “PRODUCT” by adding the attribute value from “1025” to “1026”.

Trans_ID 3: Update the table “PART” by removing the attribute value from “567” to “566”.

Trans_ID 4: Update the table “PART” by removing the attribute value from “98” to “97”.

Trans_ID 5: Update the table “PART” by removing the attribute value from “549” to “548”.

Trans_ID 6: End of the transaction.

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
This is a question that I have and would like someone who has experiences with scene graphs and entity component systems to answer.For context, I am currently implementing a game engine and currently I am debating on our current design.Our current design is we have a singular game component class that every component inherits from. Where we have components like SpriteRendererComponent, Mehs Component, etc. They inherit from this GameComponent class. The point of this is being able to have O(1) access to the scene to being able to modify components to attach more components with the idea of accessing those components to specific scene objects in a scene.Now, my question is what kinds of caveauts can this cause in terms of cache coherence? I am well aware that yes its O(1) and that is great but cache coherence is going to be really bad, but would like to know more explicit details and real-life examples such as write in RAM examples on how this is bad. A follow-up question that is part…
Q4: Consider the following MAILORDER relational schema describing the data for a mail order company. (Choose five only). PARTS(Pno, Pname, Qoh, Price, Olevel) CUSTOMERS(Cno, Cname, Street, Zip, Phone) EMPLOYEES(Eno, Ename, Zip, Hdate) ZIP CODES(Zip, City) ORDERS(Ono, Cno, Eno, Received, Shipped) ODETAILS(Ono, Pno, Qty) (10 Marks) I want a detailed explanation to understand the mechanism how it is Qoh stands for quantity on hand: the other attribute names are self-explanatory. Specify and execute the following queries using the RA interpreter on the MAILORDER database schema. a. Retrieve the names of parts that cost less than $20.00. b. Retrieve the names and cities of employees who have taken orders for parts costing more than $50.00. c. Retrieve the pairs of customer number values of customers who live in the same ZIP Code. d. Retrieve the names of customers who have ordered parts from employees living in Wichita. e. Retrieve the names of customers who have ordered parts costing less…
Q4: Consider the following MAILORDER relational schema describing the data for a mail order company. (Choose five only). (10 Marks) PARTS(Pno, Pname, Qoh, Price, Olevel) CUSTOMERS(Cno, Cname, Street, Zip, Phone) EMPLOYEES(Eno, Ename, Zip, Hdate) ZIP CODES(Zip, City) ORDERS(Ono, Cno, Eno, Received, Shipped) ODETAILS(Ono, Pno, Qty) Qoh stands for quantity on hand: the other attribute names are self-explanatory. Specify and execute the following queries using the RA interpreter on the MAILORDER database schema. a. Retrieve the names of parts that cost less than $20.00. b. Retrieve the names and cities of employees who have taken orders for parts costing more than $50.00. c. Retrieve the pairs of customer number values of customers who live in the same ZIP Code. d. Retrieve the names of customers who have ordered parts from employees living in Wichita. e. Retrieve the names of customers who have ordered parts costing less than$20.00. f. Retrieve the names of customers who have not placed…
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    Database Systems: Design, Implementation, & Manag...
    Computer Science
    ISBN:9781285196145
    Author:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
    Publisher:Cengage Learning
    Text book image
    A Guide to SQL
    Computer Science
    ISBN:9781111527273
    Author:Philip J. Pratt
    Publisher:Course Technology Ptr
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781285196145
Author:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:Cengage Learning
Text book image
A Guide to SQL
Computer Science
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Course Technology Ptr