2 views
23 Jan 2026
Transfer 500 from account 1 to account 2 using a transaction....
3 views
23 Jan 2026
Inside one transaction, read the same row twice. Show the basic idea using SELECT statements....
2 views
23 Jan 2026
Show that you should lock a row before updating by using SELECT ... FOR UPDATE....
2 views
23 Jan 2026
Set transaction isolation level to READ COMMITTED for a transaction....
2 views
23 Jan 2026
Two sessions update same row. Show a safe pattern using a version column and conditional update....
4 views
23 Jan 2026
Write a transaction that counts active orders, then inserts a new active order. Mention isolation needed in description and show SERIALIZABLE statement....
2 views
23 Jan 2026
While placing an order, keep a savepoint after reserving stock. If payment fails, rollback to savepoint....
2 views
23 Jan 2026
Two transactions lock resources in opposite order. Provide two scripts in sample_solution separated by a pipe symbol....
2 views
23 Jan 2026
When processing an order, lock it so two workers do not process it together. Write a safe SELECT FOR UPDATE pattern....
4 views
23 Jan 2026
Decrease Inventory.qty by requested amount only if enough stock. Make it atomic in one statement and run inside a transaction....
2 views
23 Jan 2026
Implement a safe job-queue pop: pick one NEW job, lock it so others can't pick it, mark it IN_PROGRESS, and return the picked job_id. Use FOR UPDATE SKIP LOCKED if available....
4 views
23 Jan 2026
Wallet(user_id, balance). Two payments at same time should not allow negative balance. Write a safe transaction with check....
3 views
23 Jan 2026
You need a consistent report while inserts keep happening in parallel. Start a transaction in REPEATABLE READ and run your report query inside it....
2 views
23 Jan 2026
Two doctors on call table. Each transaction sees at least one on call and turns itself off, resulting none on call. Use SERIALIZABLE to prevent....
3 views
23 Jan 2026
While processing orders, sometimes you get stuck waiting on locks. Set a short lock timeout, pick one NEW order with a row lock, update it to PROCESSING, then commit....