2
Guys I’m developing a shopping cart...
I arrived at a part that ended up gone wrong... the next cart consists of product recipe is additional and removal of ingredients
tabela produtos
id nome id_lanche preço
1 X-egg 1 7.00
2 X-tudo 2 9.00
tabela receita
id nome id_lanche preço quantidade (quantiodade no caso e quanto o produto tem de cada item)
1 alface 1 1.00 1
2 bacon 1 2.00 2
3 Cheddar 1 2.00 2
4 Bife 1 3.00 1
5 alface 2 1.00 1
6 bacon 2 2.00 2
7 Ovo 2 2.00 1
8 Bife 2 3.00 1
Tabela estoque
id nome quantidade
1 alface 10
2 bacon 5
turns out there’s one lettuce with id 1 and one with id 2... He can’t identify the item to drop... in stock I thought by name I just don’t think it’s 100% effective... if the name I spelled wrong it won’t work...
you could help me develop an effective way?
Another improvement, by your modeling shown here, I do not see the need for the field
id_lanche
on the tableprodutos
, once the fieldsid e id_lanche
are equal. So you could relate only to theid
, being like this:receita.id_lanche = produtos.id
, unless you have another table calledlanche
that is not being shown in the example, there can ignore everything I said.– KaduAmaral
@Kaduamaral, thanks for the advice. I’ve used it in the project, I had even other things kind of duplicated tbm
– Willian