I'm new in this domain and like to write an application managing genealogical data. My main concern is how to store and retreive these data from MySQL. I know that DB like Oracle are optimised for recursive queries, but maybe I can find an alternative solution to use MySQL which I undestand is not supporting "CONNECT" . PS. I know that there are thousands of existing Open source solutions, but consider that these data will be a limited part of the functionality, and I need to keep control of the full code.
I had a quick look on the web and found some interesting approach, for instance Interval-based algo which is perfect for queries but not satisfactory for update / deletion.
I'm going to have a look on Prefix-based(Dewey) approach, but one may know an efficient and proven approach to share ?
thanks
gilles
First problem, design data schema: I keep hierarchis with a foreign key to parent row. It is simply.
Second problem, retrieve ascendants/descendants: As you explain, problems comes with select: select some people and all descendants os ascendants. To solve this you should to create a new tree table. This table contains pairs: al combination to a person with all they ancestors (and itself):
Noticie that with this structure is easy to query hierarchies. Sample: all descendants of somebody:
You can play with distance to get only grandparents, grandwchildren, etc. ...
Last problem, keep tree: tree must be all time up to data. You should automatize this: a trigger over
people
or a store procedure for CRUD operations,EDITED
Because this is a Genealogy tree, each person must to have both references, parent and mother:
Then, 2 trees are needed:
David ask for sample data:
regards.