Product Attributes


I’m wondering if anyone could help with the following issue, as it turns out my issue is more complicated than I originally thought.

Basically, I have come up with a small database design to allow me to store product attributes, with price changes/stock level. So I could store an attribute for a product that adds £10 to the price and has 10 stock. See below:

However, what I’m having more of an issue with is storing combinations of attributes for stock levels. I’ve tried a few links tables, but everything seems to get very messyt pretty quickly. Is my original design (above)?

Any suggestions greatly appreciated.


do a search for entity-attribute-value (EAV) and you will see that many people struggle with this

it’s not you, it’s the hopelessly overgeneralized design

Here is a design you can try instead. It is rather complex but provides the ability to specify distinct pricing per physical item without being to repetitive.

products (think of this as a abstract bucket that groups physical products ie. part numbers).

  • id
  • title


  • id
  • products_id (product physical item belongs to)
  • sale_price
  • msrp
  • stock


  • id
  • products_id (product attribute corresponds to)
  • attribute (name of attribute for products such as; color, size, weight, etc)
  • weight (ordering when product has more then a single attribute)


  • id
  • product_attributes_id (attribute value corresponds)
  • attribute_value (value of attribute for color ie. red, blue, yellow, etc)


  • product_part_numbers_id (physical item)
  • product_attribute_values_id (attribute value)

Distinct pricing, stock info and attribute value combinations can now be specified per physical item (part_number).

oddz, can I trouble you to explain the realtionship between the top two tables. I ain’t getting it yet. (I understand the others :slight_smile: )

What I mean is:
if I sell a product, it can have only one price so that would be a 1:1 relationship

if I sell a product that comprises others (eg big mac meal has a burger, fries and drink), the relationship is still 1:1 innit?

or is this a category : subCategory relationship?


| 1 | Menswear |

| 1 | Trousers |
| 2 | Socks |

| 1 | 1 | material | 1 |

| 1 | 1 | Linen |

If that is correct, I am confused as to why product_attributes is related to the products table and not, the product_part_numbers table