1
I want to create a table called 'product' that has your id and quantity in stock and another table called 'purchase', the purchase table will have the primary key of the product and the purchase id, then I wanted to decrease the quantity in the stock of the 'product' table every time a purchase is made, how would it do that?
but like, how would I do that? I want q at the time we insert a product already decreasing automatically from stock, I would do it using a Trigger?
– Nathan Silva
You can do it the way you think best, da to do it using Rigger, or when the person for example click on finish the purchase you run the mysql function.
– Dudut
how would you look using Trigger? I don’t know how to implement a Trigger
– Nathan Silva
I’m not the best person to explain to you how to do this with Rigger, because I make sql requests and then give an update for example. I do the Insert first in the shopping table and after an update in the products table to decrease the stock. Got it?
– Dudut
thank you very much my friend, your logica helped me mt, solved my problem
– Nathan Silva