Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSQLtransactions BEGIN COMMITSingle-choice MCQ

Inside a single transaction you INSERT a row, then run a SELECT for that same value before committing. What does the SELECT return, and what would a separate concurrent session see?

BEGIN; INSERT INTO accounts (id, bal) VALUES (1, 100); SELECT bal FROM accounts WHERE id = 1; -- in the SAME transaction -- (no COMMIT yet)