I need to store a list of numbers, preferably into a single cell. I have a list of people each with a unique ID and I need to be able to who their family members are. I'm fairly new to SQL databases to try to keep it fairly simple please.
Do not do this: storing multiple values in the single column kills the possibility of using referential integrity constraints, and turns into a nightmare to maintain (imagine maintaining everyone's lists when a new baby's born!)
The simplest solution is to add a column with a family_id
to each person's row. All members of the same family will have this unique ID set to the same value; members of different families will have different family_id
s.
This is not ideal in cases of marriages, unless you are willing to either join the two families on marriage of their children, or move the bride or the groom to the family of the spouse.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With