I need help with the following structure in my database.
These are the tables
- PriceList
- OptionalGroup
- ProductGroup
- Product
Now I need to structure this things up, lets begin from the last table article.
The article belongs to a product, then the product belongs to a productgroup, then the productgroup belongs to an OptionalGroup, and the OptionalGroup belongs to a PriceList.
And today the relationship looks like this.
- Table: PriceList
- Table: OptionalGroup has ForeignKey to PriceListId
- Table: ProductGroup has ForeignKey to OptionalGroup
- Table: Product has ForeignKey to ProductGroup
Sample data:
> Pricelist: 81
> OptionalGroup: Shoes
> ProductGroup: Shoelace
> Product: Shoelace 1
> Product: Shoelace 2
How should I design this?
In this way, to get a product I need to now pricelist, optionalgroup, productgroup then I can get the product. Because pricelist has their own OptionalGroup and it could also have the same optionalgroup name.