The three data tables follow:
??? attribute stores the name of the attributes, such as Size and Color.
??? attribute_value contains the possible attribute values for each attribute group. There
is a one-to-many relationship between attribute and attribute_value. Each attribute,
take Color for example, can have several values associated with it??”Red, Orange, Yellow,
and so on. We need this table to help us to link the attribute_id (like 1 for Color) to its
attribute_value_ids for its possible values (Red, Orange, Yellow, and so on). So, it will
contain three columns: attribute_id, which is found in the attribute table and tells us
what kind of attribute we are talking about (e.g., a color or a size); attribute_value_id,
the integer we assign to uniquely identify the items in the attribute_value table itself;
and value, which will hold the text description like Orange, Red, S (for small), M (for
medium), and so on.
??? product_attribute is an associate table implementing a many-to-many relationship
between the product and attribute_value tables, with (product_id, attribute_value_id)
pairs (the attribute_value table will allow us to quickly and easily populate this table).
?– Note The system you??™re implementing doesn??™t permit an attribute to change the price of the product. For
example, a white t-shirt will always have the same price as a black t-shirt.
Pages:
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276