There was an interview test in which below was the table and structure
Table Person = id, name, dob, dod, mother_id, father_id
Primary Key (id)
Foreign Key mother_id references Person
Foreign Key father_id references Person
and it was asked
- “select all who are mothers”
- “select those child who are children of ‘John Smith’ and ‘Jane’
and I was puzzled because I was assuming that foreign key would be linked with some other table as usual. But at that point I failed. do some one know the actual answer and reason?
This kind of data structure is called a “Self Referencing Table”
and