Solved

1:1 relationship in DB

Posted on 2011-02-21
3
444 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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:Ephraim Wangoya
Ephraim Wangoya 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
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…

726 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