A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

One-to-many relationship need entry on the many side?



 
 
Thread Tools Display Modes
  #1  
Old September 10th, 2008, 12:05 AM posted to microsoft.public.access.tablesdbdesign
Pamela
external usenet poster
 
Posts: 193
Default One-to-many relationship need entry on the many side?

Would it violate referential integrity to, for test reasons, input entries
into the "one" side without at least one entry on the "many" side? Thanks!

  #2  
Old September 10th, 2008, 12:45 AM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default One-to-many relationship need entry on the many side?

On Tue, 9 Sep 2008 16:05:01 -0700, Pamela
wrote:

Would it violate referential integrity to, for test reasons, input entries
into the "one" side without at least one entry on the "many" side? Thanks!


No. You can have a chicken that hasn't laid any eggs, but you can't have an
egg unless you have a chicken to lay it.

In fact, the situation you describe will ALWAYS exist at some point - you've
got to enter the parent record first, before you're even able to create child
records.
--

John W. Vinson [MVP]
  #3  
Old September 10th, 2008, 12:48 AM posted to microsoft.public.access.tablesdbdesign
Graham Mandeno
external usenet poster
 
Posts: 593
Default One-to-many relationship need entry on the many side?

Hi Pamela

No, not at all. It happens all the time. Consider a new customer who
hasn't yet made any purchases.

In fact, you MUST create the record on the one side before you can create
any related records on the many side.
--
Good Luck :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand

"Pamela" wrote in message
...
Would it violate referential integrity to, for test reasons, input entries
into the "one" side without at least one entry on the "many" side?
Thanks!



  #4  
Old September 10th, 2008, 02:48 AM posted to microsoft.public.access.tablesdbdesign
Pamela
external usenet poster
 
Posts: 193
Default One-to-many relationship need entry on the many side?

Thank you - that was my logic but I have been running into some problems that
I think stem from my relationships and wanted to make sure that that scenario
wasn't the root.

"John W. Vinson" wrote:

On Tue, 9 Sep 2008 16:05:01 -0700, Pamela
wrote:

Would it violate referential integrity to, for test reasons, input entries
into the "one" side without at least one entry on the "many" side? Thanks!


No. You can have a chicken that hasn't laid any eggs, but you can't have an
egg unless you have a chicken to lay it.

In fact, the situation you describe will ALWAYS exist at some point - you've
got to enter the parent record first, before you're even able to create child
records.
--

John W. Vinson [MVP]

  #5  
Old September 10th, 2008, 02:48 AM posted to microsoft.public.access.tablesdbdesign
Pamela
external usenet poster
 
Posts: 193
Default One-to-many relationship need entry on the many side?

Thank you - that was my logic but I have been running into some problems that
I think stem from my relationships and wanted to make sure that that scenario
wasn't the root.

"Graham Mandeno" wrote:

Hi Pamela

No, not at all. It happens all the time. Consider a new customer who
hasn't yet made any purchases.

In fact, you MUST create the record on the one side before you can create
any related records on the many side.
--
Good Luck :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand

"Pamela" wrote in message
...
Would it violate referential integrity to, for test reasons, input entries
into the "one" side without at least one entry on the "many" side?
Thanks!



  #6  
Old September 12th, 2008, 03:26 AM posted to microsoft.public.access.tablesdbdesign
Armen Stein
external usenet poster
 
Posts: 507
Default One-to-many relationship need entry on the many side?

On Tue, 09 Sep 2008 17:45:10 -0600, John W. Vinson
wrote:

On Tue, 9 Sep 2008 16:05:01 -0700, Pamela
wrote:

Would it violate referential integrity to, for test reasons, input entries
into the "one" side without at least one entry on the "many" side? Thanks!


No. You can have a chicken that hasn't laid any eggs, but you can't have an
egg unless you have a chicken to lay it.

In fact, the situation you describe will ALWAYS exist at some point - you've
got to enter the parent record first, before you're even able to create child
records.


Nice explanation John.

But I'll also add that you have to decide whether the foreign key in
the child table is required. Many people think that a foreign key
with a null value violates referential integrity. It doesn't. You
can use the Required property to control whether the field must have a
value. Referential Integrity will ensure that if it does have a
value, that the value is valid (exists in the related table).

So, you can have an egg who doesn't know who its mommy is, and still
meet referential integrity. It's up to you to specify Required if you
don't want this sad situation.

Armen Stein
Microsoft Access MVP
www.JStreetTech.com

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:44 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.