Awesome; thanks!
On Sat, Oct 31, 2015 at 7:19 AM, Andy Colson wrote:
> On 10/30/2015 05:10 PM, David Blomstrom wrote:
>
>> Just so I understand what's going on, I can create a lookup table by
>> pasting this code...
>>
>>
> I don't know anything about biology so this data might be laughable, but
On 10/30/2015 05:10 PM, David Blomstrom wrote:
Just so I understand what's going on, I can create a lookup table by pasting
this code...
I don't know anything about biology so this data might be laughable, but its
based on your original question:
http://stackoverflow.com/questions/33402831/
I think I answered my question @
http://www.the-art-of-web.com/sql/lookup-table/
It sounds like the field taxon_id is similar to the field id - it's just
automatically populated by a numerical key. So if I add a new taxon on row
5, then the taxon_id for the following row with change from 5 to 6 -
Sorry, I don't think I specified that at the beginning.
My original/master table has several fields, four of which are relevant to
this hierarchical stuff - id, taxon, parent, parent_id.
The first is a numerical key, from 1 to probably somewhere around 8,000 for
mammals, 1 to 10,000 for birds, et
On 10/30/2015 04:55 PM, David Blomstrom wrote:
The field descr would presumably hold the values I originally had in
the field Taxon - e.g. the names of various taxons, like 'Mammalia'
and 'Canis-lupus.' The field id is just a numerical key, and I already
have the numerical values for parentid.
On 10/30/2015 04:55 PM, David Blomstrom wrote:
The field descr would presumably hold the values I originally had in
the field Taxon - e.g. the names of various taxons, like 'Mammalia'
and 'Canis-lupus.' The field id is just a numerical key, and I already
have the numerical values for parentid.
The field descr would presumably hold the values I originally had in the
field Taxon - e.g. the names of various taxons, like 'Mammalia' and
'Canis-lupus.' The field id is just a numerical key, and I already have the
numerical values for parentid.
But what am I supposed to put in the field taxoni
Yes, I guess it does make sense to keep a copy of your actions.
In the meantime, I now have two new tables with the following schema:
-- Table: public.taxon
-- DROP TABLE public.taxon;
CREATE TABLE public.taxon
(
taxonid integer NOT NULL DEFAULT nextval('taxon_taxonid_seq'::regclass),
descr
On 10/30/2015 04:38 PM, David Blomstrom wrote:
Ah, yes - "Execute SQL." It created the table this time. Awesome.
One other question - when I close the SQL window, it asks me if I want
to save the file. Is there any special reason for saving it? It looks
like it simply saved a copy of the query
Ah, yes - "Execute SQL." It created the table this time. Awesome.
One other question - when I close the SQL window, it asks me if I want to
save the file. Is there any special reason for saving it? It looks like it
simply saved a copy of the query I executed.
On Fri, Oct 30, 2015 at 3:36 PM, Adri
On 10/30/2015 03:29 PM, David Blomstrom wrote:
Thanks for the tips.
In pgAdmin III, I can create a table step-by-step by choosing Edit >
Object > New Table
But is there a pace for me to past in a block of code that creates the
table with just one process? If I click on the SQL icon, a SQL windo
On 30/10/2015 22:29, David Blomstrom wrote:
> Thanks for the tips.
>
> In pgAdmin III, I can create a table step-by-step by choosing Edit >
> Object > New Table
>
> But is there a pace for me to past in a block of code that creates the
> table with just one process? If I click on the SQL icon, a
Thanks for the tips.
In pgAdmin III, I can create a table step-by-step by choosing Edit > Object
> New Table
But is there a pace for me to past in a block of code that creates the
table with just one process? If I click on the SQL icon, a SQL window opens
up, and I can past the code into SQL Edit
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
>
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 integ
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 integ
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
On 10/30/2015 4:36 PM, Andy Colson wrote:
On 10/30/2015 3:47 PM, David Blomstrom wrote:
No, I get the same T_FUNCTION error.
Someone commented that the function...
create function tax_rank(id integer) returns text as $$
select case id
when 1 then 'Classes'
w
On 10/30/2015 3:47 PM, David Blomstrom wrote:
No, I get the same T_FUNCTION error.
Someone commented that the function...
create function tax_rank(id integer) returns text as $$
select case id
when 1 then 'Classes'
when 2 then 'Orders'
when 3 th
On 10/29/2015 7:18 PM, David Blomstrom wrote:
Can anyone tell me how to write the query described @
http://stackoverflow.com/questions/33402831/count-descendants-in-hierarchical-query
?
The answer's very thorough, but I don't know how to string two queries
and a function together like that. This
No, I get the same T_FUNCTION error.
Someone commented that the function...
create function tax_rank(id integer) returns text as $$
select case id
when 1 then 'Classes'
when 2 then 'Orders'
when 3 then 'Families'
when 4 then 'Genera'
David,
Does wrapping the transaction with BEGIN; COMMIT; work as you would expect?
$sql = "BEGIN; with recursive hier(taxon,parent_id) as (
select m.taxon, null::integer
from gz_life_mammals m
where taxon='Mammalia' --<< substitute me
union all
select m.taxon, m.parent_id
from hier,
Can anyone tell me how to write the query described @
http://stackoverflow.com/questions/33402831/count-descendants-in-hierarchical-query
?
The answer's very thorough, but I don't know how to string two queries and
a function together like that. This doesn't work:
$sql = "select * from gz_life_ma
23 matches
Mail list logo