+ 2

How to create family tree database design?

How can create tables and relationships for family tree? I don’t want create table for each generation. it’s not possible to use parent-child relationship because a child can be parent.

7th Feb 2022, 1:41 PM
hamid
hamid - avatar
5 RĂ©ponses
0
What we can say for sure, is that every person has exactly one father and one mother. So this can be solved with a single "person" table which contains all family members, with the reference to each parent in different fields. Then you can build a hierarchical recursive query to find all ancestors of a child.
8th Feb 2022, 5:10 AM
Tibor Santa
Tibor Santa - avatar
0
Family tree may have more than 5 generation, not just a father and mother and they children. And if use one table for many families with many rows its not good way.
8th Feb 2022, 7:52 AM
hamid
hamid - avatar
0
it is a graph one table of Persons second table for relations: Person1, Person2, relation_type then you can list all near relations to Person1
10th Feb 2022, 9:19 PM
zemiak
0
zemiak can you explain more please
10th Feb 2022, 9:52 PM
hamid
hamid - avatar
11th Feb 2022, 4:54 AM
Tibor Santa
Tibor Santa - avatar