1:1 relationship in DB

if i have two tables in a DB that has a 1:1 relationship, and i am trying to create corresponding parent and child classes (parent would contain one child), does it matter which one is the parent and which one is the child?
mmingfeilamAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
AkAlanConnect With a Mentor Commented:
It would if there were times when one table would have a record without a match in the other. That table would be the parent.
0
 
Paul JacksonConnect With a Mentor Software EngineerCommented:
Unless I am missing something in a 1:1 relationship there has to be a matching record in both tables.
It will be easier to advise if you can give us a summary of the schema of the two tables.

Do they both use the same id in matching as the primary key column ? or is one a foreign key.
If one is a foreign key then that would be the child table.
0
 
Ephraim WangoyaConnect With a Mentor Commented:


If a parent can only have one child, then what is the reason of having the child at all. It would be better if gave a sample structure of the data you are trying to store.
It maybe that you just need a table with an ID and ParentID on it
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.