From: | Miguel Vaz <pagongski(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: problem with table structure |
Date: | 2010-07-09 10:14:29 |
Message-ID: | AANLkTim35kex9MbL4ceL0FOjJYLUG3V1AkpcunI7JZ1-@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi, Tim,
I was looking for an opinion on the actual table structure. :-) How should i
build the data set? Is my second example ok? The first is the long version
but i wanted to put together all the common fields to both types of "sites"
and then (maybe) build tables to accomodate the specific fields so there are
no empty columns on the table if i put everything in the same table.
Pag
On Fri, Jul 9, 2010 at 10:30 AM, Tim Landscheidt <tim(at)tim-landscheidt(dot)de>wrote:
> Miguel Vaz <pagongski(at)gmail(dot)com> wrote:
>
> > [...]
> > * sites (generic):
>
> > id_site
> > name
> > description
> > x
> > y
>
> > * site_natural
> > id
> > id_site
> > altitude
>
> > * site_arqueology
> > id
> > id_site
> > id_category
> > id_period
>
> > But i seem to be missing something. How can i have this in a way that its
> > easy to list only "arqueology sites" for example. I feel the solution is
> > simple enough, even for me, but its eluding me. Any help in the right
> > direction would be very appreciated.
>
> You mean archaeological sites that are not also natural
> sites?
>
> | SELECT * FROM site_arqeuology
> | WHERE id_site NOT IN
> | (SELECT id_site FROM site_natural);
>
> There are numerous other ways to do this, i. e., with "LEFT
> JOIN", "EXCEPT", etc.
>
> Tim
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
From | Date | Subject | |
---|---|---|---|
Next Message | Alban Hertroys | 2010-07-09 11:25:36 | Re: problem with table structure |
Previous Message | Jayadevan M | 2010-07-09 09:47:14 | Queries about PostgreSQL PITR |