Database Design
-
I am developing an ecommerce website, aimed at selling electronic products. So for storing the product details I use a product table in which I have the fields for storing the product specifications. My problem is how to include the specifications of different products like motherboard, mouse, Monitor in a single table (product table). How should I design the product table to hold the specifications of different products. Suggest me a good database design for this problem.
-
I am developing an ecommerce website, aimed at selling electronic products. So for storing the product details I use a product table in which I have the fields for storing the product specifications. My problem is how to include the specifications of different products like motherboard, mouse, Monitor in a single table (product table). How should I design the product table to hold the specifications of different products. Suggest me a good database design for this problem.
You can have two tables like this: In product table: ProductId ProductName ProductType and in ProductTypeCodes: ProductTypeCode ProductType
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
-
I am developing an ecommerce website, aimed at selling electronic products. So for storing the product details I use a product table in which I have the fields for storing the product specifications. My problem is how to include the specifications of different products like motherboard, mouse, Monitor in a single table (product table). How should I design the product table to hold the specifications of different products. Suggest me a good database design for this problem.
You need to think about the data - I'd get plenty of examples and see how they look - what attributes define a particular product for example. A possible suggestion is two tables: one to hold products and the other to hold attributes. This is a simplified example of this approach.
Product Table
ProductID
ProductName
ProductTypeAttribute Table
AttributeID
ProductID
Attribute
ValueExamples:
Products
1, LG XYZ, TFT Monitor
2, AX-999, MotherboardAttributes
1, 1, Screen Size, 22
2, 1, Colour, Black
3, 2, CPU Type, AMD
4, 2, PCI Sockets, 3You need to link the tables. Also this is probably too simplistic - think about the units for attributes. Some will numeric others strings.
Regards David R --------------------------------------------------------------- "Every program eventually becomes rococo, and then rubble." - Alan Perlis
-
You need to think about the data - I'd get plenty of examples and see how they look - what attributes define a particular product for example. A possible suggestion is two tables: one to hold products and the other to hold attributes. This is a simplified example of this approach.
Product Table
ProductID
ProductName
ProductTypeAttribute Table
AttributeID
ProductID
Attribute
ValueExamples:
Products
1, LG XYZ, TFT Monitor
2, AX-999, MotherboardAttributes
1, 1, Screen Size, 22
2, 1, Colour, Black
3, 2, CPU Type, AMD
4, 2, PCI Sockets, 3You need to link the tables. Also this is probably too simplistic - think about the units for attributes. Some will numeric others strings.
Regards David R --------------------------------------------------------------- "Every program eventually becomes rococo, and then rubble." - Alan Perlis