Interviews4 answers
A product table has a record of product. Table has only one record and this product accessing three user.First user has purchased product then how restrict second use to update that record.
4 Answers
By using concurrency locking we can lock the row until the user working on it,
When the user completes the work the lock gets released
Krishna TejaPosted Dec 27, 2020, 10:14 AM EST
Use timestamp column which will keep track of record version, while placing the order use this timestamp value as a part of your stock update statement.
Amit PhadtarePosted Oct 22, 2018, 1:16 AM EDT
You need to create Order table in which there will be entry for that product with quantity and user who has purchased that product. And for another users who are trying to purchase that product we can check from Order table with Product table to check available quantity.
kevin shahPosted Oct 1, 2018, 2:35 AM EDT
you can try to introduce a flag of purchase in product table, as soon as user has purchased and that flag will be true and after that you can restrict the other user to updated.
mukul agrawalPosted Sep 28, 2018, 10:10 PM EDT
