Re: [OT] Inventory systems (private)

From: Dan MacNeil <omacneil(at)lctc(dot)org>
To: Ries van Twisk <ries(at)jongert(dot)nl>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: [OT] Inventory systems (private)
Date: 2002-12-03 15:07:02
Message-ID: Pine.LNX.4.44.0212030959580.15959-100000@brave.cs.uml.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2002-12-03 15:18:42 Re: problem with view in 7.3
Previous Message Ries van Twisk 2002-12-03 15:06:10 Re: [OT] Inventory systems (private)