Re: Hierarchical Query Question (PHP)

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Hierarchical Query Question (PHP)
Date: 2015-10-30 22:18:33
Message-ID: 5633ECB9.2020703@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/30/2015 04:10 PM, David Blomstrom wrote:
> Just so I understand what's going on, I can create a lookup table by
> pasting this code...
>
> create table taxon (
> taxonid serial,
> descr text
> );
> create table gz_life_mammals (
> id serial,
> taxonid integer, -- use the lookup table
> parentid integer -- use the lookup table
> );
>
> ...into pgAdmin III, right? (I can't use the shell/terminal at the
> moment, and it will be at least a few weeks before I can get it
> fixed.) And this script will create TWO tables - gz_life_mammals and a
> matching "lookup table"?
>
If I'm following correctly it will create two tables, the first is the
definition of the lookup table. You should add an index its taxonid (if
'serial' doesn't imply that?)

In the second table (gz_lief_mamals) have taxonid and parentid as
"foreign keys" to taxon.taxonid.

The gui side of pgAdmin3 should help out here, but it's been quite a
while since I was there.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rob Sargent 2015-10-30 22:18:39 Re: Hierarchical Query Question (PHP)
Previous Message David Blomstrom 2015-10-30 22:10:21 Re: Hierarchical Query Question (PHP)