?
Solved

1:1 relationship in DB

Posted on 2011-02-21
3
Medium Priority
?
447 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 332 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 336 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 332 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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

770 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