On 30/10/2015 22:10, 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"? Yes, it will. I haven't seen, what went before in this thread so may have missed stuff, but you should also add a foreign key constraint between the tables (for taxonid anyway, dunno what parentid refers to): create table gz_life_mammals ( id serial, taxonid integer, -- use the lookup table parentid integer, -- use the lookup table constraint mammals_taxon_fk foreign key (taxonid) references taxon(taxonid) ); If parentid also references taxon.taxonid, add a similar constraint for it too, Ray. -- Raymond O'Donnell :: Galway :: Ireland rod@xxxxxx -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general