Imagine you’re running an online store, there’s exactly one item left in stock. Two customers click Buy at almost exactly the same time. Both requests reach your application. Both transactions ask the database:
SELECT stock FROM products WHERE id = 10;
Enter fullscreen mode
Exit fullscreen mode
And both get:






