You might create a seperate attribute tables.

table: items
id
name

table: attributes
id
description


table: item_attributes
item_id
attribute_id


SELECT
        items.name, attributes.description
FROM
        items, attributes, item_attributes
WHERE
            items.id=item_attributes.item_id
        AND item_attributes.item_id = attributes.id;

If some items are also attributes of other items (a car has an engine) you
might look at tree structures.

Of course there are already existing inventory systems that it might be
cheaper to use than to grow your own.


On Tue, 3 Dec 2002, Ries van Twisk wrote:

> Hi All,
>
> is there any whitepaper, document or website that can point me to how to
> setup a inventory system?
> I'm particulary interested how other people solve the problem of a unknown
> number of attributes to a inventory item.
>
> example:
> BAL                <-- Inventory Item
>       - Color      <- Attribute
>       - Diameter   <- Attribute
>       - Weight     <- Attribute
>
> Car                <-- Inventory Item
>       - Speed      <- Attribute
>       - Size       <- Attribute
>       - Weight     <- Attribute
>       - Color      <- Attribute
>
> Computer                <-- Inventory Item
>       - Brand           <- Attribute
>       - Weight          <- Attribute
>       - Windows/Linux   <- Attribute
>
>
> I can ofcource add any number of columns to a table but for a lot of items
> there will be a lot of NULL values and currently I don't know how many
> attrubutes one item can have (possible between 10 and 20). This can even
> change in feature opon request.
>
> Ries
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to