WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Junction tables

 
   Home -> Office other -> Table Design RSS
Next:  Design Question  
Author Message
Anne

External


Since: Oct 01, 2008
Posts: 1



(Msg. 1) Posted: Wed Oct 01, 2008 12:04 pm
Post subject: Junction tables
Archived from groups: microsoft>public>access>tablesdbdesign (more info?)

I used Access long ago, and am now using Microsoft Access 2003. All data is
currently in multiple Excel files. I am migrating them to Access 2003.

I am starting with three tables in Access: Hospitals, Clinics, and Contacts.
The Hospitals and Clinics tables contain address and phone numbers for each
institution.
The Contacts table contains a list of physicians, nurses, and other
personnel related to the hospitals and clinics.
Each contact may serve more than one clinic and/or hospital.

The goal is to be able to enter a single hospital or clinic name (i.e.
General Hospital) and retrieve all names from the contact table related to
this hospital.
The same is true for the reverse: to be able to enter a single contact name
(i.e. Dr. Smith) and retrieve all of the hospitals and clinics that Dr. Smith
is listed as a contact for.

My question deals with how to build the relationships between the tables.
Do I need to combine the Hospital and Clinics table, and create a junction
table that will use the primary keys from this and the Contact table?

Can I keep the three tables separate, and somehow create relationships that
will result in successful queries, without having to repeat information in a
junction table?

Can a junction table be used with more than two tables?

Let me know if I need to include more information.

Thanks.



--
Anne
Back to top
Login to vote
KARL DEWEY

External


Since: Mar 03, 2006
Posts: 3052



(Msg. 2) Posted: Wed Oct 01, 2008 12:47 pm
Post subject: RE: Junction tables [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

>>Do I need to combine the Hospital and Clinics table,
Combine and add field to designate Hospital/Clinic. Also add an Autonumber
as primary key.

>>and create a junction table that will use the primary keys from this and the Contact table?
I do not see a requirement for junction table. Add a number field, long
integer, as a foreign key and set a one-to-many relationship from
Hospital_Clinic table primary key. Use a form/subform with Master/Child link
using the Hospital_Clinic table primary key and Contact foreign key.
--
KARL DEWEY
Build a little - Test a little


"Anne" wrote:

> I used Access long ago, and am now using Microsoft Access 2003. All data is
> currently in multiple Excel files. I am migrating them to Access 2003.
>
> I am starting with three tables in Access: Hospitals, Clinics, and Contacts.
> The Hospitals and Clinics tables contain address and phone numbers for each
> institution.
> The Contacts table contains a list of physicians, nurses, and other
> personnel related to the hospitals and clinics.
> Each contact may serve more than one clinic and/or hospital.
>
> The goal is to be able to enter a single hospital or clinic name (i.e.
> General Hospital) and retrieve all names from the contact table related to
> this hospital.
> The same is true for the reverse: to be able to enter a single contact name
> (i.e. Dr. Smith) and retrieve all of the hospitals and clinics that Dr. Smith
> is listed as a contact for.
>
> My question deals with how to build the relationships between the tables.
> Do I need to combine the Hospital and Clinics table, and create a junction
> table that will use the primary keys from this and the Contact table?
>
> Can I keep the three tables separate, and somehow create relationships that
> will result in successful queries, without having to repeat information in a
> junction table?
>
> Can a junction table be used with more than two tables?
>
> Let me know if I need to include more information.
>
> Thanks.
>
>
>
> --
> Anne
Back to top
Login to vote
Pindaro

External


Since: Oct 01, 2008
Posts: 2



(Msg. 3) Posted: Wed Oct 01, 2008 12:52 pm
Post subject: RE: Junction tables [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi Anne,

As you suggest yourself the appropriate way to go is to create a
many-to-many relationship between hospitals and contacts. Also another one
between clinics and contacts. To do this you will need to create a junction
table whose primary key will be the combination of the primary keys of the
tables that you would like to join.

So if the junction table for Hospitals and Contacts is named
tbl_HospitalsContacts, then its primary key will be (HospitalID, ContactID).
This is a composite primary key based on two fields.

Then, you are free to work with your data both ways.

"Anne" wrote:

> I used Access long ago, and am now using Microsoft Access 2003. All data is
> currently in multiple Excel files. I am migrating them to Access 2003.
>
> I am starting with three tables in Access: Hospitals, Clinics, and Contacts.
> The Hospitals and Clinics tables contain address and phone numbers for each
> institution.
> The Contacts table contains a list of physicians, nurses, and other
> personnel related to the hospitals and clinics.
> Each contact may serve more than one clinic and/or hospital.
>
> The goal is to be able to enter a single hospital or clinic name (i.e.
> General Hospital) and retrieve all names from the contact table related to
> this hospital.
> The same is true for the reverse: to be able to enter a single contact name
> (i.e. Dr. Smith) and retrieve all of the hospitals and clinics that Dr. Smith
> is listed as a contact for.
>
> My question deals with how to build the relationships between the tables.
> Do I need to combine the Hospital and Clinics table, and create a junction
> table that will use the primary keys from this and the Contact table?
>
> Can I keep the three tables separate, and somehow create relationships that
> will result in successful queries, without having to repeat information in a
> junction table?
>
> Can a junction table be used with more than two tables?
>
> Let me know if I need to include more information.
>
> Thanks.
>
>
>
> --
> Anne
Back to top
Login to vote
Pindaro

External


Since: Oct 01, 2008
Posts: 2



(Msg. 4) Posted: Wed Oct 01, 2008 1:18 pm
Post subject: RE: Junction tables [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi Anne,

You also mention that one contact person might serve more than one
hospitals/clinics. If this is the case, you need to be able to see the
number of hospitals by contact name. If this is correct, then you needs to
create a many-to-many relationship and thus a junction table so that you can
work both ways.

Is this what you would like to do?


"Anne" wrote:

> I used Access long ago, and am now using Microsoft Access 2003. All data is
> currently in multiple Excel files. I am migrating them to Access 2003.
>
> I am starting with three tables in Access: Hospitals, Clinics, and Contacts.
> The Hospitals and Clinics tables contain address and phone numbers for each
> institution.
> The Contacts table contains a list of physicians, nurses, and other
> personnel related to the hospitals and clinics.
> Each contact may serve more than one clinic and/or hospital.
>
> The goal is to be able to enter a single hospital or clinic name (i.e.
> General Hospital) and retrieve all names from the contact table related to
> this hospital.
> The same is true for the reverse: to be able to enter a single contact name
> (i.e. Dr. Smith) and retrieve all of the hospitals and clinics that Dr. Smith
> is listed as a contact for.
>
> My question deals with how to build the relationships between the tables.
> Do I need to combine the Hospital and Clinics table, and create a junction
> table that will use the primary keys from this and the Contact table?
>
> Can I keep the three tables separate, and somehow create relationships that
> will result in successful queries, without having to repeat information in a
> junction table?
>
> Can a junction table be used with more than two tables?
>
> Let me know if I need to include more information.
>
> Thanks.
>
>
>
> --
> Anne
Back to top
Login to vote
Larry Daugherty

External


Since: May 11, 2004
Posts: 1551



(Msg. 5) Posted: Wed Oct 01, 2008 3:51 pm
Post subject: Re: Junction tables [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

FWIW you might want to list both Hospitals and Clinics in a common
table: tblOrganization. The type of organization becomes an attribute
in the new table. That will significantly reduce the number of
relationships and forms and reports that you need to manage. You
might then have a single junction table: tblOrganizationContacts that
handles the many-to-many relationship. That will provide the hooks
for all of the rest of the things you want to do.

HTH
--
-Larry-
--

"Anne" <anne DeleteThis @discussions.microsoft.com> wrote in message
news:BAF2509E-C8C3-42B0-9DF7-96120BA73672@microsoft.com...
> I used Access long ago, and am now using Microsoft Access 2003. All
data is
> currently in multiple Excel files. I am migrating them to Access
2003.
>
> I am starting with three tables in Access: Hospitals, Clinics, and
Contacts.
> The Hospitals and Clinics tables contain address and phone numbers
for each
> institution.
> The Contacts table contains a list of physicians, nurses, and other
> personnel related to the hospitals and clinics.
> Each contact may serve more than one clinic and/or hospital.
>
> The goal is to be able to enter a single hospital or clinic name
(i.e.
> General Hospital) and retrieve all names from the contact table
related to
> this hospital.
> The same is true for the reverse: to be able to enter a single
contact name
> (i.e. Dr. Smith) and retrieve all of the hospitals and clinics that
Dr. Smith
> is listed as a contact for.
>
> My question deals with how to build the relationships between the
tables.
> Do I need to combine the Hospital and Clinics table, and create a
junction
> table that will use the primary keys from this and the Contact
table?
>
> Can I keep the three tables separate, and somehow create
relationships that
> will result in successful queries, without having to repeat
information in a
> junction table?
>
> Can a junction table be used with more than two tables?
>
> Let me know if I need to include more information.
>
> Thanks.
>
>
>
> --
> Anne
Back to top
Login to vote
Display posts from previous:   
       Home -> Office other -> Table Design All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
 Windows Other
 Office
  Office Other
 Security
 WinRAR
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET