"how to save marital relationship in a database" Code Answer

5

if you can only be maried to one person: 1:1

-------------
- person    -
-------------
id (key)
maried_to_id (foreign key)

if you can be maried to more than one person or want to keep track of previous mariages, n:n

-------------
- person    -
-------------
person_id (key)

-------------
- mariage   -
-------------
first_person_id (foreign key)
second_person_id (foreign key)
start_date
end_date

(also first_person_id + second_person_id + date form a unique key for mariage. you could leave out the date, but then remariages wouldnt be tracked)

By Borgleader on March 28 2022

Answers related to “how to save marital relationship in a database”

Only authorized users can answer the Search term. Please sign in first, or register a free account.