Solved

1:1 relationship in DB

Posted on 2011-02-21
3
435 Views
Last Modified: 2012-05-11
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?
0
Comment
Question by:mmingfeilam
3 Comments
 
LVL 6

Accepted Solution

by:
AkAlan earned 83 total points
Comment Utility
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
 
LVL 29

Assisted Solution

by:Paul Jackson
Paul Jackson earned 84 total points
Comment Utility
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
 
LVL 32

Assisted Solution

by:ewangoya
ewangoya earned 83 total points
Comment Utility


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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now