Re: Hierarchical Query Question (PHP) - Mailing list pgsql-general

From Rob Sargent
Subject Re: Hierarchical Query Question (PHP)
Date
Msg-id 5633ECB9.2020703@gmail.com
Whole thread Raw
In response to Re: Hierarchical Query Question (PHP)  (David Blomstrom <david.blomstrom@gmail.com>)
List 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.



pgsql-general by date:

Previous
From: David Blomstrom
Date:
Subject: Re: Hierarchical Query Question (PHP)
Next
From: Rob Sargent
Date:
Subject: Re: Hierarchical Query Question (PHP)