There is an idea to make a conclusion of the family tree data. Assume that the data is entered from top to bottom and there are no additional branches yet, just a Christmas tree, i.e. neither mistresses nor stepfathers yet. The following questions

  1. How to implement intergenerational and intragenerational binding?
  1.2 Suppose that when filling in the table I immediately bind the spouse to the spouse ID, and in the spouse line I specify the offspring ID, but then later there will be difficulties in specifying children not from this spouse.
  2. How best to fill the base?  Make 1 table with data about people and 2 table with data about connections, or can you think of something here? 

Maybe someone has a ready-made suitable script, or someone stumbled upon a similar algorithm? I will be glad to any help))

OK, I'm making a table of families

 famID int(11) // PRIMARY KEY wedding date //Π”Π°Ρ‚Π° ΡΠ²Π°Π΄ΡŒΠ±Ρ‹ divorce date //Π”Π°Ρ‚Π° Ρ€Π°Π·Π²ΠΎΠ΄Π° dive tinyint(1) //БостояниС Π±Ρ€Π°ΠΊΠ° father int(11) // ID Π½ΠΎΠΌΠ΅Ρ€ ΠΈΠ· individuals mother int(11) // ID Π½ΠΎΠΌΠ΅Ρ€ ΠΈΠ· individuals 
And the table of individuals
 1 ID int(11) // PRIMARY KEY 2 name varchar(50) //Имя 3 firstname varchar(50) //Ѐамилия 4 gender char(1) //Пол 5 birth date //Π”Π°Ρ‚Π° роТдСния 6 death date //Π”Π°Ρ‚Π° смСрти 7 comment varchar(200) //ΠšΠΎΠΌΠΌΠ΅Π½Ρ‚Π°Ρ€ΠΈΠΈ 8 famC int(11) //famID 
So, families will display all connections, if this is a husband and a wife, then a famID number is assigned. If their child, then individuals recorded in famC family number of parents. It seems to work ...

  • It should not. It will work. This scheme excludes the birth of children from parents who live, for example, in a civil marriage =) Or who never marry at all. I would individual.famC replaced by 2 fields: father id and mother id. And in families, it’s not the father and the mother, but the husband and the wife. - Vitaly Kustov
  • Well, as if there is a famID.families connection, then their children will already have a mark in famC.individuals. In principle, this is simply nothing changing the place in the tables. Another question is how to display these links? There is an idea to use the harvested images of straight lines and corners, the algorithm will of course be long, but in my most reliable way than using the GD library to draw lines. - Webmon
  • How to deduce - here only your fantasy business is limited. I will say about myself - I would never have started using GD. The use of css + html is much more transparent. - Vitaly Kustov

2 answers 2

As an option, you can store all the information you need about a person in the person table, including the id of his parents (foreign key). In another table, store the "marriage certificates" in one column of the husband's id, in the other - the wife's id. In this scenario, you will be able to do anything. SQL is flexible. I hope helped.

    For the processing of genealogical data traditionally used specifically designed for this language - Prologue

    use graph database

    neo4j as the most famous, library connectors are under everything that moves