Explain deadlock with small example
SQL
Medium
2 views
Problem Description
Two transactions lock resources in opposite order. Provide two scripts in sample_solution separated by a pipe symbol.
Sample Test Case
Output:
Deadlock scenario
Official Solution
BEGIN; UPDATE TableA SET val=1 WHERE id=1; UPDATE TableB SET val=1 WHERE id=1; COMMIT; | BEGIN; UPDATE TableB SET val=2 WHERE id=1; UPDATE TableA SET val=2 WHERE id=1; COMMIT;
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!