Re: Not sure how to approach this

From: <jctown_at_nb.sympatico.ca>
Date: 3 Sep 2006 15:04:24 -0700
Message-ID: <1157321064.834744.274120_at_i42g2000cwa.googlegroups.com>


Andy Hardy wrote:
> jctown_at_nb.sympatico.ca wrote:
> > I have 3 tables.
> > 1) books
> > 2) publishers
> > 3) subjects
> >
> > I *think* I need to use a trigger but not sure.
> > I've loaded up publishers with distinct publisher from books and
> > subjects from distinct subject from books. Now I want to set
> > *something* up so that if I add a new row to "books" a check will be
> > made on publishers and subjects to see if something new is being added
> > and then add a row if this is the case.
> >
> > Something like
> >
> > On_New_Book
> > insert into publishers
> > select publisher from book
> > where book.publisher not in (select publisher from book)
> > insert into subjects
> > select subject from book
> > where book.subject not in (select subject from book)
> >
> > I don't know how close or far away I am. I'm not even sure if a
> > "trigger" is what I need here.
> >
>
> You want to be able to see distinct publishers and distinct subjects
> based on information from your books? If so, sounds like you actually
> want to use views instead of tables for your 'publishers' and 'subjects'.

That worked. So tell me something... does Oracle actually keep the "view" stored physically like it does a table or is it more virtual? Received on Mon Sep 04 2006 - 00:04:24 CEST

Original text of this message