Solved

1:1 relationship in DB

Posted on 2011-02-21
3
442 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
ID: 34947497
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
ID: 34947782
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
ID: 34947849


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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
CCModeler offers a way to enter basic information like entities, attributes and relationships and export them as yEd or erviz diagram. It also can import existing Access or SQL Server tables with relationships.
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…

810 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