Subject | Re: Design question for "attributed instances" |
---|---|
Author | Ali Gökçen |
Post date | 2005-10-22T10:02:09Z |
Hi Heiko,
CREATE TABLE CATEGORY (
ID INTEGER PRIMARY KEY ,
NAME VARCHAR(32) NOT NULL UNIQUE
);
CREATE TABLE ATTRIBUTE (
ID INTEGER PRIMARY KEY,
NAME VARCHAR(32) NOT NULL UNIQUE
);
CREATE TABLE ITEM (
CAT_ID INTEGER NOT NULL REFERENCES CATEGORY(ID),
ATT_ID INTEGER NOT NULL REFERENCES ATTRIBUTE(ID),
NAME VARCHAR(32) NOT NULL UNIQUE
);
Regards.
Ali
--- In firebird-support@yahoogroups.com, "tdtappe" <tappe@t...>
wrote:
CREATE TABLE CATEGORY (
ID INTEGER PRIMARY KEY ,
NAME VARCHAR(32) NOT NULL UNIQUE
);
CREATE TABLE ATTRIBUTE (
ID INTEGER PRIMARY KEY,
NAME VARCHAR(32) NOT NULL UNIQUE
);
CREATE TABLE ITEM (
CAT_ID INTEGER NOT NULL REFERENCES CATEGORY(ID),
ATT_ID INTEGER NOT NULL REFERENCES ATTRIBUTE(ID),
NAME VARCHAR(32) NOT NULL UNIQUE
);
Regards.
Ali
--- In firebird-support@yahoogroups.com, "tdtappe" <tappe@t...>
wrote:
>hierarchy
> Hi folks,
> I would like to hear your opinion on the following problem/design.
>
> Imagine there is a list of so called "categories".
> Could be some table like (but could also be something completely
> different)
>
> CREATE TABLE CATEGORY (
> ID INTEGER,
> NAME VARCHAR(32));
>
> Furthermore there is a list of "attributes" like
>
> CREATE TABLE ATTRIBUTE (
> ID INTEGER,
> NAME VARCHAR(32));
>
> Now I would like to store "instances" of categories, which have
> specific values for each attribute.
>
> Example: Imagine a category called "POSITION". Now I would like to
> create "an instance" of "POSITION" with
> the values "HEIKO" for an attribute "FIRSTNAME" and "PC1" for an
> attribute "COMPUTERNAME".
>
> For each such instance of a category I would like to store a
> of keys and values. But that shouldkey
> not be the problem here. I just need to know some kind of primary
> (ID ?) of the category instance that stands
> for a category with the specific values for each attribute.
>
> Any thoughts?
>
> --Heiko
>