I would like to ask if there are multiple sub-items in a main commodity
multiple sub-items will have their own inventory
how can the database plan correctly?
main commodity
prod_id / stock / price
1 / 0 / 0
2 / 0 / 0
3 / 0 / 0
4 / 10 / 30
Sub-merchandise
sub_id(PK) / prod_id / stock / price
1 / 1 / 15 / 50
2 / 3 / 20 / 10
3 / 2 / 300 / 50
4 / 1 / 30 / 30
5 / 2 / 50 / 100
main merchandise 4 has no sub-merchandise, so it has its own inventory and price
1, 1, 2, and 3 all have its own sub-merchandise, so the main merchandise has no inventory and price (eyes dead
Shopping cart: the record of adding goods to the shopping cart (I still have who the delivery person is and I will not list the brand ID)
cart_id(PK) / prod_id / quan / price
the above shopping cart is the main item of based on.
if you add sub-items to the shopping cart, it will explode
and other databases that will explode.
and then there will be problems
.
will only display the main item. This is very simple
, but with more sub-items, I really don"t know what to do.
I revolve around the main commodity
so the main commodity plus sub-merchandise really hurts my balls.
I wonder how you have a lot of experience to deal with these problems.
what would you do if it was a big deal?