Re: Implementing product attributes

From: Thomas Muller <ttm_at_online.no>
Date: 2000/03/18
Message-ID: <RWRA4.18191$6b1.308533_at_news1.online.no>#1/1


Fernando <spamers_at_must.die> wrote in message news:s8u6dsgnvpgrf3q4imhpnhdlirlrs248iv_at_4ax.com...
> Hi!
>
> I have a datbase with n products. Each of these products
> belongs to 1 and only one cathegory.
>
> For example: I have 10 different beers, 5 magazines and 30
> books. So, every beer belongs to the cathegry "beverages", while every
> book belongs to "Books", etc...
>
> The attributes of a product depends on which cathegory it
> belongs too, and are usually very different from cathegory to
> cathegory. While the list of attributes is a function of the
> cathegory, the values of those attributes is a function of the
> product.
>
> What's the best way to model this thing? O:-) Right now I
> have a products table and a cathegories table, but how do you handle
> the product attributes, while enforcing data integrity (never letting
> a book to be assigned to "beverages", etc...)? O:-)
>

category: (cat_id, cat_name, ...) // PK = cat_id product: (prod_id, cat_id, prod_name, ...) // PK = prod_id attribute: (attrib_id, cat_id, attrib_name, ...) // PK = attrib_id attribute_value: (attrib_id, prod_id, value,...) // PK = attrib_id, prod_id

--

Thomas
Received on Sat Mar 18 2000 - 00:00:00 CET

Original text of this message