Design question
From: san <sans11_at_hotmail.com>
Date: 3 May 2003 23:37:59 -0700
Message-ID: <8e29a54a.0305032237.8747d64_at_posting.google.com>
Hi,
I have an application that deals with an entity called "Document". A
"Document" can have several attributes. These attributes can be either
of {int, float, date, string} type. However, I do not know beforehand the number of attributes. The user may add more attributes to this
"Document" entity. For example, right now it may have attributes such
as <Author>, <Creation_Date>. Later, a user may add <Num_Pages>. So, modeling the "Document" entity as a relation with attributes as column names is difficult. I had this approach in mind and wanted to know if there is a better way.
San Received on Sun May 04 2003 - 08:37:59 CEST
Date: 3 May 2003 23:37:59 -0700
Message-ID: <8e29a54a.0305032237.8747d64_at_posting.google.com>
Hi,
I have an application that deals with an entity called "Document". A
"Document" can have several attributes. These attributes can be either
of {int, float, date, string} type. However, I do not know beforehand the number of attributes. The user may add more attributes to this
"Document" entity. For example, right now it may have attributes such
as <Author>, <Creation_Date>. Later, a user may add <Num_Pages>. So, modeling the "Document" entity as a relation with attributes as column names is difficult. I had this approach in mind and wanted to know if there is a better way.
I was thinking of creating a relation DocAttr(AttributeName, AttributeValue). I can create 4 such relations for each of {int, float, string and date}. DocAttrInt, DocAttrFloat, DocAttrString and DocAttrDate. Then I can store <Author, "Some Name"> in DocAttrString.
This way more attributes can be added on later or existing ones can be removed.
Is there a better way? Keep in mind that I am required to use an
RDBMS. Thanks,San Received on Sun May 04 2003 - 08:37:59 CEST