Now there are four pieces of clothing, such as pants, jacket, underwear and socks
Then each product has different colors
For example, pants are available in black, blue and white
<code>外套有 白色 棕色 红色 内衣有 黑色 白色 粉红色 袜子有 花色 藏青色 </code>
Then each product is divided into men and women
The size is male X XL XXL
For women, size s (one size smaller than X) X XL
We also need inventory with different attributes for each product.
How to design such a table? Please give me some advice and design a database
Now there are four pieces of clothing, such as pants, jacket, underwear and socks
Then each product has different colors
For example, pants are available in black, blue and white
<code>外套有 白色 棕色 红色 内衣有 黑色 白色 粉红色 袜子有 花色 藏青色 </code>
Then each product is divided into men and women
The size is male X XL XXL
For women, size s (one size smaller than X) X XL
We also need inventory with different attributes for each product.
How to design such a table? Please give me some advice and design a database
Hope this article can help you, http://www.cnblogs.com/mmmjia...
The attributes are color and size
<code>颜色表 颜色id 颜色值 尺码表 尺码id 尺码 库存表 产品id 颜色id 尺码id 库存 价格</code>
Attributes are not fixed
<code>属性分类表 分类id 分类名 属性表 属性id 分类id 属性名 库存表 产品id 属性id(多个逗号隔开) 库存 价格</code>
Entity-Attribute-Value Model (EAV model)
First of all, there are two tables, namely the product table + product attribute table
The product table and the attribute table have a one-to-many relationship
So the product table saves some fixed attributes such as product name, total inventory, remaining inventory, etc. It depends on the specific situation, such as yours The pants, jackets, etc.
The attribute table saves the inventory under the current attributes of the color, size, etc.
I wonder if you have any ideas?