Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

QUESTION: Give an example of a query or statement that would conflict with the a

ID: 3606031 • Letter: Q

Question

QUESTION: Give an example of a query or statement that would conflict with the above UPDATE statement if both the statements are run at the same time (when run concurrently). Explain what could go wrong, and how locking tuples would solve the problem.

Branch Publisher Em ployee EmployeeID CHAR(8) BranchID INT Branch Name VARCHAR(45) Branch Address VARCHAR … ONumberOfEmployees INT PublisherID CHAR(3) PublisherName VARCHAR(45) PublisherCity VARCHAR (30) Publish&Contactio; AR(10) EmployeeName VARCHAR(45) EmployeeType VARCHAR(20) Supervisor-EmployeeID CH Indexes Indexes Inventory DutyRoster EmployeeID CHAR(8) BranchID INT t Branch_BranchID INT Book_BookID INT AvailableQuantity INT Indexes t WorkingShiftID INT Book BookID INT WorkingShift WorkingShiftID INT workingShiftWeekDay VARCHAR (15) workingShiftStartTime TIME(6) WorkingShiftEndTim e TIME(6) dutyType VARAR(20) Indexes BookTitle VARCHAR(45) BookType VARCHAR (45) Book Price DECIMAL (8,2) 1sPaperback VARCHAR(3) Writes Author_AuthorID INT Book_BookID INT Author AuthorID INT AuthorName VARCHAR(45) AuthorE mail Address V ARCHAR (45) Indexes sequenceNumber INT Publisher, Publisher!D CHAR(3) Indexes Figure 1 : Relational Data Model

Explanation / Answer

Here if we use the following query then there may be conflict problem if executes concurrently.

update workingshift set dutytype ='officers'

where workingshiftID = 5001;

Here the problem is both query want to update the same data so based on the execuition the final result may changes.

what changes are made at last (or) which query executes last in those two queries that result wil be saved.

sol:  

If locking is used then that row (or) complete table is locked so after completion of one query, and commiting data only lock will be resolved, so here no inconsistent reults will come.