On Wed, Sep 17, 2008 at 11:38 AM, Jeffrey Santos <[EMAIL PROTECTED]>wrote:
> Hi David, > > My project involves storing information that could have been gathered from > wildly different sources. You can think of this part of the database as a > sort of bibliography for the sources of that information. If I gathered > information from a book, for instance, there are some generally required > fields such as "Author," "Title," ... etc. A website, on the other hand, > would also require fields such as "URL" and "Date Visited" and so on and so > forth. > > I hope that's more clear! > Ah, OK, the essence of your problem is what is called in some programming languages a "variant record". One table is related to another table in a one-to-many relationship, the the items in the second table may vary wildly in what needs to be stored. http://en.wikibooks.org/wiki/Programming:Ada:Types:record#Variant_record The simplest real-life example I can think of would be to make a record of each citizen of the world and all of their property. The is a one-to-many relationship between people and property. The problem is that each item of property has different attributes. A computer will have different things you want to record than a goat. I'm not qualified to even guess at this question in the context of MySQL. I'm sure others can be more helpful. The two approaches that come to mind are: a)For simple problems, in the second table to have an enumerated "discriminator" field and a set of additional fields that is the union of everything required, with some unused depending on the discriminator. b)A more sophisticated approach involving named attributes. I've gotta bow out of this one. For all I know, MySQL might support variant records directly. I'm not worthy, I'm not worthy ... Dave.