1
So guys I’m modeling a database in Mysql that has 4 tables
- USERS
- REQUESTS
- PRODUCTS
- STOCKPILE
A PEDIDO
who owns ID_USUARIO
, ID_PRODUTO
and STATUS
, and when the request is made he will have the ESTADO = "PENDENTE"
, what I want is when I approve in the bank the request for "OK" it takes a code XXXX-XXXX-XXXX-XXXX
of my stock of same ID_PRODUTO
and assign that request, where the code can only be used once and when you have another request "APROVADO"
he assigns another code to another request, it seems simple, but I’m racking my brain with it
And what rule of formation of this code that, as I understand it, varies with each use?
– anonimo
Can’t solve it via Trigger?
– Caio Augusto Papai