I have a problem with a task that I am developing.
The problem is this: the application is about a distributor of products in which the employees go to the different stores and place the orders, the problem is what, when making several orders simultaneously decreases the stock of the product to negative values, example Two employees ask for a product that has 10 units, by doing so the stock is reduced by 20, resulting in a stock of -10 which is an error.
My question is how can I update the stock field in the database correctly so that it does not happen.