Re: many-to-one relationship

From: Paul Keister <remove-this-keister_at_dnai.com>
Date: Sat, 21 Jul 2001 23:27:36 GMT
Message-ID: <9f4l71$pca$1_at_bob.news.rcn.net>


It may be trivial, but it's not as clean or efficient as a direct join which can be optimized in a parameterized view. Also, referential integrity can't be enforced using this approach which means you may have nothing to join to.

"Steve Long" <steven.long_at_erols.maps_on.com> wrote in message news:9f410e$6lk$1_at_bob.news.rcn.net...
> oracle8i supports the use of variables for table names in a FROM clause.
> using a string value from a column representing a table name is trivial.
>
> "Sam Staton" <sam.staton_at_bigfoot.com> wrote in message
> news:5psahtg62tg613kllhjdano3k9fsgvaa0i_at_4ax.com...
> > As I suggested.
> >
> > This will work fine, as long as you do not need to obtain the
> > SomeTableX row which corresponds to a particular NoteTable record (I
> > guess you are not likely to need to do this anyway).
> >
> > For this you will need to do a messy union, as previously mentioned.
> >
> >
> > On Wed, 30 May 2001 18:08:22 -0400, "Steve Long"
> > <steven.long_at_erols.maps_on.com> wrote:
> >
> > >this is quite easy.
> > >
> > >create sequence noteID_seq; -- produces a unique note_id for every
 note
 in
> > >the database.
> > >create sequence someID_seq -- produces a unique ID for every
 'something'
 in
> > >the database
> > >
> > >SomeTable1 (..., someID, ...) -- data table for some data with or
 without
> > >notes
> > >SomeTable2 (..., someID, ...) -- another data table for some data with
 or
> > >without notes
> > >...
> > >SomeTableN (..., someID, ...) -- another data table for some data with
 or
> > >without notes
> > >
> > >NoteTable (someID, noteID, ...) -- table containing all notes
> > >
> > >Any insert statements to SomeTables shoud use someID_seq.nextval and
> > >noteID_seq.nextval for the respective ID values.
> > >Whenever a row is inserted into SomeTable which has a note, a
 correpsonding
> > >entry in NoteTable should be made.
> > >
> > >It is important to remember the "parent-child" relationship. A common
> > >mistake is forgetting that in a relational model, the
> > >parent table does not require any knowledge of the child table. This
> > >structure is very similar to a "bill-of-materials" or
> > >invoice structure where there is a master table containing header
> > >information and then a line-item table containing each
> > >of the line items associated with a given master element.
> > >
> > >"Steve Croft" <stevec_at_ditdash.com> wrote in message
> > >news:3B1084AA.3060902_at_ditdash.com...
> > >> 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:36 CEST

Original text of this message