CS FundamentalsModerateIBM · Deloitte pattern
A transaction executes `UPDATE Accounts SET balance = balance - 100 WHERE id = 1;` followed immediately (same transaction) by `SELECT balance FROM Accounts WHERE id = 1;`, both before COMMIT. What value does the SELECT see, under ANY standard isolation level?
- A. The transaction's OWN uncommitted update is always visible to itself, regardless of isolation level — isolation levels govern visibility of OTHER transactions' changes, not a transaction's own in-progress changes
- B. NULL, since uncommitted changes are invisible to everyone, including the transaction that made them
- C. It depends entirely on whether autocommit is enabled
- D. The pre-update value, since the UPDATE hasn't committed yet
Correct answer: A. The transaction's OWN uncommitted update is always visible to itself, regardless of isolation level — isolation levels govern visibility of OTHER transactions' changes, not a transaction's own in-progress changes
Isolation levels are about what a transaction can see of concurrent OTHER transactions' work; every transaction always sees its own writes immediately, even before committing — otherwise a single transaction could never build on its own prior statements, which would make multi-statement transactions useless.
More DBMS and SQL questions
- A B+ tree index supports efficient range queries because leaf nodes are linked in sorted order. For a query WHERE age BETWEEN 25 AND 35…
- A table is partitioned by RANGE on a date column (e.g. one partition per year). A query filters WHERE saledate BETWEEN '2023-01-01' AND…
- A relation R(A, B, C, D, E) has FDs AB → CDE and E → B. What are the candidate key(s) of R?
- Using the same R(A, B, C, D, E) with AB → CDE and E → B, how many superkeys does R have in total?
- R(A, B, C) has NO nontrivial functional dependencies at all (every attribute is independent of every other). What is R's only candidate…
- A relation R(A, B, C, D) has FDs A → BC and D → A (so D is also, indirectly, able to derive B and C). What are the candidate keys of R?