MattioMatt
Registered User.
- Local time
- Today, 03:32
- Joined
- Apr 25, 2017
- Messages
- 99
Needing some help with the best practice with an approach to setting up some tables for a Product/Sub Product and Product Versions. I believe I’ve set it up wrong and trying to work out the best way to move forward.
Some background information..
Now, I have set the following up… I think because there is no link between the sub product and versions it’s not going to work as above with the requirements. I believe it only allows for a version linked to a product and not a sub version.
Product (Table Name)
Product_ID (PK)
Product Name
Product_Has_Sub_Product (Table Name)
Sub_Product_ID (PK)
Product_ID (FK to Product Table)
Sub_Product_Name
Product_Versions (Table Name)
Version_ID (PK)
Product_ID (FK to Product Table)
Version_Name
I have two thoughts, neither of which I am not sure is the right approach – was looking for some input into my thoughts below.
Thought 1:
Product_Has_SP_Has_Version (Table Name)
Product_Version_SP_ID (PK)
Product_ID (FK, Product Table)
Sub_Product_ID (FK to Product_Has_Sub_Product Table)
Version_ID (FK to Product_Versions Table)
Thought 2:
Product_Versions (Table Name)
Version_ID (PK)
Sub_Product_ID (FK to Product Table)
Version_Name
Some background information..
- A Product can have many Sub Products but also may not have one at all
- A Product will have at least 1 version but could have many
- Sub Products may have a version
- The version of the sub product may differ to the version of the product it is linked to
Now, I have set the following up… I think because there is no link between the sub product and versions it’s not going to work as above with the requirements. I believe it only allows for a version linked to a product and not a sub version.
Product (Table Name)
Product_ID (PK)
Product Name
Product_Has_Sub_Product (Table Name)
Sub_Product_ID (PK)
Product_ID (FK to Product Table)
Sub_Product_Name
Product_Versions (Table Name)
Version_ID (PK)
Product_ID (FK to Product Table)
Version_Name
I have two thoughts, neither of which I am not sure is the right approach – was looking for some input into my thoughts below.
Thought 1:
Product_Has_SP_Has_Version (Table Name)
Product_Version_SP_ID (PK)
Product_ID (FK, Product Table)
Sub_Product_ID (FK to Product_Has_Sub_Product Table)
Version_ID (FK to Product_Versions Table)
Thought 2:
Product_Versions (Table Name)
Version_ID (PK)
Sub_Product_ID (FK to Product Table)
Version_Name