Lets consider that we have Person A. Person F is his father, person M is his mother, person B is his brother and person S is his son. Each person may have many relations. Thats why, we have to create new relationship table like following:
persons
+----+------+
| id | name |
+----+------+
| 1 | A |
| 2 | F |
| 3 | M |
| 4 | B |
| 5 | S |
+----+------+
relationship type
+----+---------+
| id | value |
+----+---------+
| 1 | Father |
| 2 | Mother |
| 3 | Brother |
| 4 | Son |
| 5 | Wife |
| 6 | Husband |
+----+---------+
relationship
+----+----------+------------+------+
| id | PersonID | RelativeID | Type |
+----+----------+------------+------+
| 1 | 1 | 2 | 1 |
| 2 | 1 | 3 | 2 |
| 3 | 1 | 4 | 3 |
| 4 | 1 | 5 | 4 |
| 5 | 2 | 1 | 4 |
| 6 | 2 | 3 | 5 |
| 7 | 3 | 1 | 4 |
| ...... |
+----+----------+------------+------+
In this case 1st row means that 2 is father of 1
(for IDs) and 5th row means that 1 is son of 2
. In the real world these 2 rows are equivalent, but if I don't insert one of this rows, I cannot get missing rows meaning using existed row.
The question is: How to make structure, which contains these 2 meanings in 1 row?
relationship(id, personA, personB, AtoB_type,BtoA_type)
can help? – Cowitch