So far every query has run alone and nothing has gone wrong. Now let things go wrong. The first thing to fail is the machine, in the gap between two statements. This is the second part of the sentence.
Transaction
A group of database changes that succeed or fail as one. You BEGIN, make the changes, then COMMIT. If anything fails before the COMMIT, or the power goes, none of them happened. Moving money is the classic case: the debit and the credit must both happen, or neither.
Agents write each statement correctly and often don't wrap them, because every test passes without it. Tests don't crash between two lines. Production does, on a deploy, an out-of-memory kill or a lost connection. Look at any function with two writes in it and ask what happens if it dies between them.
“Creating the order and reducing the stock must happen together, so wrap both in one database transaction. Add a test that throws an error between the two writes and asserts neither is in the table afterwards. Don't call any external API inside the transaction.”