A product reference various sizes in the database. How to do?

Asked

Viewed 24 times

0

Hello!

I am developing a Java system with Postgresql, and now I have reached a stage where I am with a great difficulty. I have three tables that need to relate, are they:

Product: code, description, price

Unit: code, name

Stock: product, unit, quantity

The problem is in the stock, because I would like to insert, for example, 30 products in stock of Product A. If I did not use units, it would be very easy, because it would just insert them in stock and it was done. The problem is that I have to put this quantity in the units, for example: Product A receives 30 quantities, being 10 in Unit P, 10 in Unit M, 5 in Unit G and 5 in Unit GG.

How can I fix this?

Thank you!

  • Essentially it’s what you have in this question, of course you need to adapt to your need, but the question wasn’t specific at all. At last, you have to have each SKU as a different product. If you have more specific questions after you start modeling, you can ask specific questions.

  • Thanks for the answer, I already changed the title. The suggested question of answer does not correspond to my problem.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.