2

Why do some ecommerce database have tables:

  1. product
  2. product_variant

Why not only one product table with all teh fields of product_variant and is_default_product(bool) field?

Thanks

2 Answers 2

3

This is called Slowly Changing Dimension

There are some approaches to implementing it which have their benefits and drawbacks.

Solution with two tables allows easier referencing to products (as opposed to product versions) from other tables.

1
  • Can you please give example for more easier referencing to products from other tables?
    – Ben
    May 27, 2010 at 17:00
1

If you have only one table, you have to modify your database design if you want to add product attributes. So if you are tracking colors and sizes in your table, and you want to add, say, inseam, you have to add a column to the table.

Keeping a separate table of attributes allows you to easily manage your attributes as entries in the table, rather than have them be a part of the actual design.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.