I have to design a database that stores products with variable number of properties, for example:
id: 1 , name : bacon , wg: 2 , pack: 6, brand: “meat co.” , country: “canada”, etc
I can design this:
|id, keyword, value |for each keyword and then a crazy number of joins to show the data in a table|id, col1,col2,col3,col4,metadata|and then do unknown magic to query the metadata with XML or JSON- your guess
Please guide me in this.
note: I’m using LAMP and PERL
You can define a table that has products and another table that has product properties.
The product properties table can contain 3 columns. Such as product_id,product property name and value, so you can add n number of product specific properties to this table. Without exploding the joins.
In summary two tables.
So essentially this design will allow you to scale the number of properties for a product.