Alex Rivera | Logout

Best structure for inventory database

Asked 2010-12-07T18:15:13.023
26

I want to create a small database for my inventory but I have some problems on picking a structure. The inventory will be updated daily at the end of the day.

The problem I am facing is the following.

I have a table for my products, having an

id, name, price, quantity.

Now I have another table for my sales, but there is my problem. What kind of fields do I need to have. At the end of the day I want to store a record like this:

20       product_x       $ 5,00         $ 100,-
20       product_y       $ 5,00         $ 100,-
20       product_z       $ 5,00         $ 100,-
20       product_a       $ 5,00         $ 100,-
-------------------------------------------------
                                        $ 400,-

So how do I model this in a sales record. Do I just create a concatenated record with the product id's comma separated.

Or is there another way do model this the right way.

Edit
Report

1 Answer

0

I think you need a table with fields showing the transaction properties per customer OR a table with fields - date, product(foreign), quantity - this way you'll have no problem with new products

answered 2010-12-07T18:25:28.883

Your Answer