Following a batch through constraint checks

A distributor stores warehouse assignments in a database table. AssignmentID uniquely identifies each row. Every column requires a value, and the combination of WarehouseID and ProductID must be unique: the same product may appear in different warehouses, but a warehouse cannot have two rows for that product.


Each batch below starts independently from this original table:


AssignmentID

WarehouseID

ProductID

R10

W1

P7

R20

W2

P7

R30

W1

P8


Each batch runs as one transaction. The DBMS checks constraints immediately after each statement. If a statement violates a constraint, the application stops the batch and rolls back all its changes. Otherwise, the application commits after the final statement. No other transactions run.

  • Alpha: First change WarehouseID in R10 to W2. Then change WarehouseID in R20 to W3.
  • Beta: First change ProductID in R10 to P9. Then change WarehouseID in R20 to W1.
  • Gamma: First change ProductID in R10 to P9. Then, in one statement, change both WarehouseID and ProductID in R30 to W2 and P7 respectively.

Complete the table with each batch's outcome and the values stored after it finishes. Use exactly commit or rollback for the outcome, and copy identifiers exactly.

BatchOutcomeFinal ProductID in R10Final WarehouseID in R20
Alpha
Beta
Gamma

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Database Management Systems Questions: