dbTalk Databases Forums  

Re: Design question - parent/child relationship in the same table - any suggestions?

comp.databases comp.databases


Discuss Re: Design question - parent/child relationship in the same table - any suggestions? in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
programmer
 
Posts: n/a

Default Re: Design question - parent/child relationship in the same table - any suggestions? - 08-07-2003 , 05:24 AM






I used this for a family tree program I wrote for the web.

create table person(ID int, fatherID int, motherID int, gender char(1),
dateOfBirth date, dateOfDeath date, detailsOfThePerson varchar(255));

The queries can get a bit complex - eg retrieving a list of second cousins.

Recursive code is needed to show more than trivial parts of the whole tree.



Reply With Quote
  #2  
Old   
Velmurugan Periasamy
 
Posts: n/a

Default Re: Design question - parent/child relationship in the same table - any suggestions? - 08-07-2003 , 11:36 AM






Thanks for the input.

"programmer" <int.consultNOCAPITALS (AT) macmail (DOT) com> wrote in message

Quote:
I used this for a family tree program I wrote for the web.

create table person(ID int, fatherID int, motherID int, gender char(1),
dateOfBirth date, dateOfDeath date, detailsOfThePerson varchar(255));

The queries can get a bit complex - eg retrieving a list of second cousins.

Recursive code is needed to show more than trivial parts of the whole tree.

Reply With Quote
  #3  
Old   
Mike Preece
 
Posts: n/a

Default Re: Design question - parent/child relationship in the same table - any suggestions? - 08-12-2003 , 06:56 AM



velmurugan_p (AT) yahoo (DOT) com (Velmurugan Periasamy) wrote in message news:<198e6a10.0308061351.48fcd656 (AT) posting (DOT) google.com>...
Quote:
Any suggestions, thoughts?
How about a question?

Suppose you've got a database. It's all about fishing and the fish you
get with different tackle combinations. There are various types of
bait, hooks, weights, lines, reels, rods... etc.. OK. So you normalise
your database so as to be able to update and retrieve data in any
combination.

Is there a tool that provides metrics on which combinations are most
often associated?

I mean, your bait is more often attached to your hook - more often
than it is to your reel or rod. There's a natural heirachy of
associations. It seems sensible to me to structure your physical
database to suit. Baits for hooks for lines for rods etc..

If you want to know the tackle that's best when you're after marlin
then there'll be a limited set of related data - as opposed to when
you're interested in salmon or trout for instance.

Having a table of baits with gnat flys right alongside squid and
another with surfcasting rods alongside boat rods etc. seems to me
unsophisticated and contrary to common sense. You're never going to be
interested in which gnat fly is best for a 50lb strain line.

If you normalise the data the poor old SQL engine is going to have to
seperate out all the related data to be stored and collate it all
again to retrieve it. Wouldn't it be more sensible and efficient to
store it as it is meant to be?

I'd suggest you'd really want a single item (or record) for marlin
with the intrinsic hierachy of bait, hook, line etc. that applies and
another similar but quite different item for trout.

Btw - does anyone know if Codd's grand-children are allowed to live
with their parents?


Reply With Quote
  #4  
Old   
--CELKO--
 
Posts: n/a

Default Re: Design question - parent/child relationship in the same table - any suggestions? - 08-12-2003 , 06:52 PM



Quote:
Is there a tool that provides metrics on which combinations are
most often associated?

Any good statistics package can do that kind of data mining. I like
KnowledgeSeeker from Angoss myself becuase you get rules and a nice
Bonferroni (sp?) tree out of it.

You get correlation that show interesting patterns; for exmapel they
give a sample data set of diet, tobacco, alcohol use, and age against
blood pressure. When you push the button you find out the most
important factor is age -- "older people tend to have higher blood
pressure". But as you go down the tree, you most intrersting stuff --
"if you are old and survived all that smoking and drinking, then
cutting down on slat and red meat is more important than quittign your
vices." or "If you are young, you can eat garbage, but those smokes
are killing you!"


Reply With Quote
  #5  
Old   
Bob Badour
 
Posts: n/a

Default Re: Design question - parent/child relationship in the same table - any suggestions? - 08-13-2003 , 08:57 AM



"Mike Preece" <michael (AT) preece (DOT) net> wrote

Quote:
velmurugan_p (AT) yahoo (DOT) com (Velmurugan Periasamy) wrote in message
news:<198e6a10.0308061351.48fcd656 (AT) posting (DOT) google.com>...
Any suggestions, thoughts?

How about a question?

Suppose you've got a database. It's all about fishing and the fish you
get with different tackle combinations. There are various types of
bait, hooks, weights, lines, reels, rods... etc.. OK. So you normalise
your database so as to be able to update and retrieve data in any
combination.

Is there a tool that provides metrics on which combinations are most
often associated?

I mean, your bait is more often attached to your hook - more often
than it is to your reel or rod. There's a natural heirachy of
associations. It seems sensible to me to structure your physical
database to suit. Baits for hooks for lines for rods etc..

If you want to know the tackle that's best when you're after marlin
then there'll be a limited set of related data - as opposed to when
you're interested in salmon or trout for instance.

Having a table of baits with gnat flys right alongside squid and
another with surfcasting rods alongside boat rods etc. seems to me
unsophisticated and contrary to common sense. You're never going to be
interested in which gnat fly is best for a 50lb strain line.

If you normalise the data the poor old SQL engine is going to have to
seperate out all the related data to be stored and collate it all
again to retrieve it. Wouldn't it be more sensible and efficient to
store it as it is meant to be?

I'd suggest you'd really want a single item (or record) for marlin
with the intrinsic hierachy of bait, hook, line etc. that applies and
another similar but quite different item for trout.

Btw - does anyone know if Codd's grand-children are allowed to live
with their parents?
I don't know. Did your parents have any children who survived birth?




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.