Home > Article > Backend Development > For a mall, how should the product table and product attributes be designed better?
My product is, for example, the iPhone 6s. The colors are champagne, silver, and gray. Different colors include 16G, 32G, and 64G.
You think it is color + version + product ID = one product. In this way, one product has multiple products. They share the product introduction details, etc. What is not shared is the product album, introduction and the like.
Is it better to do the above, or treat all color versions as one product ID.
My product is, for example, the iPhone 6s. The colors are champagne, silver, and gray. Different colors include 16G, 32G, and 64G.
You think it is color + version + product ID = one product. In this way, one product has multiple products. They share the product introduction details, etc. What is not shared is the product album, introduction and the like.
Is it better to do the above, or treat all color versions as one product ID.
Color and capacity are equal. It’s just a property of the product.
Product table + product attribute table should be enough.
The product attribute table includes attribute name (such as color) and attribute value (black).
The product list is simple. Some inherent attributes, such as inventory, price, etc.
Separate the two tables. One 6S corresponds to multiple attributes. If we don’t separate the other speeds and the like, it will feel too messy at first. For the product album, you can create a separate attachment table for easy management
Just figure out spu and sku