Re: many-to-one relationship

From: Sam Staton <sam.staton_at_bigfoot.com>
Date: Sat, 21 Jul 2001 23:27:04 GMT
Message-ID: <gfgaht07djm0um5lttr83p2c3gt9g565sr_at_4ax.com>


I was waiting to see whether anyone would provide suggestions for this. It seems to me also as if it is a problem that should be easy to solve.

It goes against the relational model to store table names in tables; since SQL querying becomes quite messy for a start.

Of course, in the object-oriented world this problem can be modeled quite easily: e.g. each row contains a pointer to a bag of 'notes', and the note table is the bag of bags of notes. Of course, this OO example solution can be translated to the relational model [1] but it becomes (I think) quite messy and counter-intuitive.

In response to this provocation, do any relational worshippers have any solutions? I look forward to hearing (genuinely!).



[1] i.e. each row which could have notes has a field note_set_id. Then the note table has fields note_set_id, note_id (PK) and note_text. To obtain which row referred to the note, we have to union across all tables which have notes (potentially v nasty).

On Sun, 27 May 2001 04:40:23 GMT, Steve Croft <stevec_at_ditdash.com> wrote:

>I am having a rather sticky modeling problem. We have a number of
>different tables, rows of which may have zero, one or more notes
>attached. A note table has a type id indicating the table, and an id
>indicating the row in that particular table.
>
>I suspect there is a better way to do this - is there? If not, how do
>you diagram it?
> I'm sure it's an obvious answer but I'm not seeing it :(
>
>Thanks in advance,
>Steve
Received on Sun Jul 22 2001 - 01:27:04 CEST

Original text of this message