Re: [SQL] Table Design for Hierarchical Data

2010-04-12 Thread Leif Biberg Kristensen
On Monday 12. April 2010 17.37.58 Yeb Havinga wrote: > Leif Biberg Kristensen wrote: > > On Monday 12. April 2010 16.57.38 Rob Sargent wrote: > > > >> Believe me: "ego-ma-pa" will correctly define genealogical relationships > >> (at least among humans). > >> > > > > Yes, but a family tree i

Re: [SQL] Table Design for Hierarchical Data

2010-04-12 Thread Yeb Havinga
Leif Biberg Kristensen wrote: On Monday 12. April 2010 16.57.38 Rob Sargent wrote: Believe me: "ego-ma-pa" will correctly define genealogical relationships (at least among humans). Yes, but a family tree is not a hierarchical tree as defined in database theory. Believe me: I'm a genea

Re: [SQL] Table Design for Hierarchical Data

2010-04-12 Thread Leif Biberg Kristensen
On Monday 12. April 2010 16.57.38 Rob Sargent wrote: > Believe me: "ego-ma-pa" will correctly define genealogical relationships > (at least among humans). Yes, but a family tree is not a hierarchical tree as defined in database theory. Believe me: I'm a genealogist. Hint: Where is the root node

Re: [SQL] Table Design for Hierarchical Data

2010-04-12 Thread Rob Sargent
Believe me: "ego-ma-pa" will correctly define genealogical relationships (at least among humans). On 04/12/2010 02:14 AM, Achilleas Mantzios wrote: > Στις Thursday 08 April 2010 17:59:01 ο/η Rob Sargent έγραψε: >> The "parent" node in a genealogy is the mother-father tuple, so given >> that as a s

Re: [SQL] Table Design for Hierarchical Data

2010-04-12 Thread Achilleas Mantzios
Στις Thursday 08 April 2010 17:59:01 ο/η Rob Sargent έγραψε: > The "parent" node in a genealogy is the mother-father tuple, so given > that as a singularity it still fits a tree. No, because the child and parent node would be of different schema. > > On 04/08/2010 12:56 AM, Achilleas Mantzios wrot

Re: [SQL] Table Design for Hierarchical Data

2010-04-08 Thread Rob Sargent
The "parent" node in a genealogy is the mother-father tuple, so given that as a singularity it still fits a tree. On 04/08/2010 12:56 AM, Achilleas Mantzios wrote: > Στις Wednesday 07 April 2010 23:33:07 ο/η Yeb Havinga έγραψε: >> Achilleas Mantzios wrote: >>> Στις Wednesday 07 April 2010 11:06:44

Re: [SQL] Table Design for Hierarchical Data

2010-04-08 Thread Yeb Havinga
Achilleas Mantzios wrote: Στις Wednesday 07 April 2010 23:33:07 ο/η Yeb Havinga έγραψε: Achilleas Mantzios wrote: Στις Wednesday 07 April 2010 11:06:44 ο/η Yeb Havinga έγραψε: Achilleas Mantzios wrote: You could also consider the genealogical approach, e.g. T

Re: [SQL] Table Design for Hierarchical Data

2010-04-08 Thread Achilleas Mantzios
Στις Wednesday 07 April 2010 23:33:07 ο/η Yeb Havinga έγραψε: > Achilleas Mantzios wrote: > > Στις Wednesday 07 April 2010 11:06:44 ο/η Yeb Havinga έγραψε: > > > >> Achilleas Mantzios wrote: > >> > >>> You could also consider the genealogical approach, e.g. > >>> > >>> > >>> The parents of

Re: [SQL] Table Design for Hierarchical Data

2010-04-07 Thread Yeb Havinga
Achilleas Mantzios wrote: Στις Wednesday 07 April 2010 11:06:44 ο/η Yeb Havinga έγραψε: Achilleas Mantzios wrote: You could also consider the genealogical approach, e.g. The parents of any node to the root, i.e. the path of any node to the root are depicted as parents[0] : immediate

Re: [SQL] Table Design for Hierarchical Data

2010-04-07 Thread Lee Hachadoorian
On Tue, Apr 6, 2010 at 2:34 PM, Little, Douglas wrote: > Hey Lee, > > I’m on dm-disc...@yahoogroups.com Thanks for the pointer. I'm looking at their archives now. > Ie a row is a point in time, or average for a period of time. Are the > Numbers actual, or estimates?To be useful, you’ll want

Re: [SQL] Table Design for Hierarchical Data

2010-04-07 Thread Achilleas Mantzios
Στις Wednesday 07 April 2010 11:06:44 ο/η Yeb Havinga έγραψε: > Achilleas Mantzios wrote: > > You could also consider the genealogical approach, e.g. > > > > > > The parents of any node to the root, i.e. the path of any node to the root > > are depicted as > > parents[0] : immediate parent > > par

Re: [SQL] Table Design for Hierarchical Data

2010-04-07 Thread Achilleas Mantzios
Στις Wednesday 07 April 2010 11:26:29 ο/η Sergey Konoplev έγραψε: > On 6 April 2010 21:33, Lee Hachadoorian wrote: > > More generally, what questions should I be asking to help decide what > > structure makes the most sense? Are there any websites, forums, or books > > that cover this kind of prob

Re: [SQL] Table Design for Hierarchical Data

2010-04-07 Thread Achilleas Mantzios
Στις Wednesday 07 April 2010 10:53:00 ο/η silly sad έγραψε: > On 04/07/10 11:00, Achilleas Mantzios wrote: > > > Column | Type| Modifiers > > -+---+--- > > id | i

Re: [SQL] Table Design for Hierarchical Data

2010-04-07 Thread Sergey Konoplev
On 6 April 2010 21:33, Lee Hachadoorian wrote: > More generally, what questions should I be asking to help decide what > structure makes the most sense? Are there any websites, forums, or books > that cover this kind of problem? Haven't you thought about ltree contrib? From the description of ltr

Re: [SQL] Table Design for Hierarchical Data

2010-04-07 Thread Yeb Havinga
Achilleas Mantzios wrote: You could also consider the genealogical approach, e.g. The parents of any node to the root, i.e. the path of any node to the root are depicted as parents[0] : immediate parent parents[1] : immediate parent of the above parent What I have more than one parent? re

Re: [SQL] Table Design for Hierarchical Data

2010-04-07 Thread silly sad
On 04/07/10 11:00, Achilleas Mantzios wrote: Column | Type| Modifiers -+---+--- id | integer | not null default nextval(('public.paintgentypes_id_seq'::text)

Re: [SQL] Table Design for Hierarchical Data

2010-04-07 Thread Achilleas Mantzios
You could also consider the genealogical approach, e.g. postg...@dynacom=# \d paintgentypes Table "public.paintgentypes" Column | Type| Modifiers -+---+---

Re: [SQL] Table Design for Hierarchical Data

2010-04-06 Thread Scott Marlowe
On Tue, Apr 6, 2010 at 11:43 PM, silly sad wrote: > P.S. > almost foget, do not try any oracle-like "tree-jouns" or "special types" or > such a crap. > > your problem as plain as to store a pair of integers > (or numerics (i prefer)) Since it's an identifier and not really a numeric per se, I'd s

Re: [SQL] Table Design for Hierarchical Data

2010-04-06 Thread silly sad
P.S. almost foget, do not try any oracle-like "tree-jouns" or "special types" or such a crap. your problem as plain as to store a pair of integers (or numerics (i prefer)) -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.

Re: [SQL] Table Design for Hierarchical Data

2010-04-06 Thread silly sad
single table. nested tree + ordinal parent reference. nests are calculated in a trigger on insert. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Table Design for Hierarchical Data

2010-04-06 Thread Steve Crawford
Lee Hachadoorian wrote: I am trying to come up with a structure to store employment data by NAICS (North American Industrial Classification System). The data uses a hierarchical encoding scheme ranging between 2 and 5 digits. That is, each 2-digit code includes all industries beginning with t

Re: [SQL] Table Design for Hierarchical Data

2010-04-06 Thread Richard Broersma
On Tue, Apr 6, 2010 at 3:04 PM, Michael Glaesemann wrote: > Another is nested sets which performs quite nicely for loads which are more > read than write (which I suspect is the case here). Pg 9.0 has two new features are nice for both Nest set trees. one is deferrable unique constraints. Whil

Re: [SQL] Table Design for Hierarchical Data

2010-04-06 Thread Michael Glaesemann
On Apr 6, 2010, at 13:33 , Lee Hachadoorian wrote: > A standard way to store hierarchical data is the adjacency list model, where > each node's parent appears as an attribute (table column). Another is nested sets which performs quite nicely for loads which are more read than write (which I sus

[SQL] Table Design for Hierarchical Data

2010-04-06 Thread Lee Hachadoorian
Please point me to another listserv or forum if this question is more appropriately addressed elsewhere. I am trying to come up with a structure to store employment data by NAICS (North American Industrial Classification System). The data uses a hierarchical encoding scheme ranging between 2 and 5