Single VIEW, and FUNCTION questions...

From: wyatt(at)draggoo(dot)com
To: pgsql-sql(at)postgresql(dot)org
Subject: Single VIEW, and FUNCTION questions...
Date: 2001-11-07 02:12:03
Message-ID: 20011107021203.9606.cpmta@c001.snv.cp.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hey all,

I've got a book database here, and I'm trying to create a single VIEW that lists *all* of the books. Here are the relavent parts:

Data tables: book, author, publisher, category, series, set
These tables store the appropriate data for each table; for instance, the book table stores the ISBN (if any), title, publisher (index to publisher table), copyright year, and a primary key series.

Joining tables: bookauthor, bookcategory, bookseries, bookset
These tables are generally columns containing integers for each of the keys to join them; the bookauthor has a book key and an author key, the bookseries has a book key, series key, and the place in the series (book 1, 2, etc).
What I am trying to do is get a single VIEW to include *all* of the books, as well as the series, place in the series, and set *if* they have them. But, since not all books belong to a series or set, all I have been able to manage is to get several VIEWs: one with all of the books in a series, one with books in a set, one with books in both series *and* sets, and one with the others --- with some overlap (books in sets *and* series, for instance, end up in all three of the VIEWs).

Is there a way to get all of these into a single VIEW with a single query? Or am I going to have to do several queries from Java or Perl and put them together (final project is in Java)?

Also, I'm trying to figure out how much should be implemented as FUNCTIONS in the database, and how much should be in the Java/Web portion. For instance, when a book is deleted out of the book table, should a I delete all of the references to that book in the database with a trigger, or do it with the Java portion?

Thanks,
Wyatt

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2001-11-07 04:43:37 Re: Increasing MAX_ARGS
Previous Message Bruce Momjian 2001-11-07 02:11:35 Re: Increasing MAX_ARGS