I'm working on a product/order type of database and have trouble to setup the correct structure of tables and their relationships.
Here is some rules that I have to follow:
Any kind of insight will be appreciated.
Here is some rules that I have to follow:
- At present we have 44916 products and this number will grow in future. (Product1 - product2 - Product3 - .....)
- Tens or hundreds of these products can be assembled (Assembly1 - Assembly2 - Assembly3 - ....) and be sold as one product.
For example Assembly1 = 3 pieces of Product1 + 10 pieces of Product2 + 50 pieces of Product10 + .......
- Each Assembly can be used as a sub assembly in a higher level of assembly. There is no limit to this. (It may go down to unlimited layers)
For example
Assembly5 = 10 pieces of Product100 + 20 pieces of Product50 + 3 pieces of assembly1 (which in turn contains another sub assembly)+ .......
- The most important rule that I have to mind is that for each order, if we receive an order for an assembly that has different sub assemblies, a list of all necessary products should be saved in OrderDetails table.
(including the necessary parts used in sub assemblies and sub sub assemblies and......)
It means that an order can be a single order, or an assembly that contains sub assemblies and it may contain more than a thousand products for that single order.
Any kind of insight will be appreciated.
Last edited: