Page 1 of 2 12 LastLast
Results 1 to 15 of 26
  1. #1
    goreyr is offline Novice
    Windows 8 Access 2013
    Join Date
    Aug 2015
    Posts
    10

    I need some help with my database design- how to split common things like addresses

    Hello!

    I'm pretty new to database management software, but I'm trying to build a database for the foundation I'm working for. It needs to track a lot of different pieces of information, and I feel a little in over my head. I've watched a few strings of tutorials, but I haven't quite found the answers I need yet.

    Our foundation facilitates the placements of specially-trained dogs with professional handlers who work for different agencies all over the country.



    I was wondering what's the best way to split up common fields of information we'll need among these different groups of people. For example, handlers can have work phones and mobiles and agencies will also have phone numbers. A handler will have a home address and a work address that we'll need to store. An agency will also have their own address. In situations like these, do I try to put all the addresses that belong to handlers AND agencies in a table called tbl1Addresses? Or is it better to make tables called tbl1HandlerAddresses and tbl1AgencyAddresses?

    Thanks for the help!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    I would say need at least:

    tblAgencies
    AgencyID
    AgencyName
    Address (separate fields for street address, city, state, zip)
    Phone
    Email

    tblHandlers
    FirstName
    LastName
    HandlerID
    HomeAddress (separate fields for street address, city, state, zip)
    WorkAddress (separate fields for street address, city, state, zip)
    HomePhone
    WorkPhone
    Email
    AgencyID
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    I have a table for a person, with PersonID
    tClients
    ----------
    [personID] auto
    [FirstName]...

    a tAddress table
    tPhone table
    1 to many tables for addresses, and phones

    tAddress
    ----------
    [AddrID] auto
    [personID] long
    [AddrType] (work, home, etc)

    so 1 person can have many addresses

    tPhones
    ----------
    [PhoneID] auto
    [personID] long
    [PhoneType] (work, home, cell, etc)

    1 person can have many phones

  4. #4
    goreyr is offline Novice
    Windows 8 Access 2013
    Join Date
    Aug 2015
    Posts
    10
    Thanks for both of your input!

    June7- Are you not separating the address information out into its own table? In my research I see that people usually do that, is that not the best way to do it?

    ranman256- That mostly makes sense to me! My main question is: since I've got handler's home and work addresses, and agency addresses, do those all go in tAddress? The problem is, a handler will have a work address and a home address. Agencies will also have their own address. It's possible that a handler's work address isn't actually the agency address. So does it make sense to split it into two address tables? One for handler addresses, and one for agency addresses?

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Depends, if you want to allow many addresses, phone, emails, etc for each individual/agency, then related tables is reasonable. For only two, not sure I would bother.

    Can have a common addresses table if the same addresses will be used by many individuals/agencies. If not, doesn't really make sense.

    It is a balancing act between normalization and ease of data entry/output. Normalize until it works, denormalize until it hurts (or vice versa).
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    goreyr is offline Novice
    Windows 8 Access 2013
    Join Date
    Aug 2015
    Posts
    10
    Okay, thanks so much! If the handler's work address is going to their primary agency's address about 85% of the time, it would probably make the most sense to have a shared address table then, correct?

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Not necessarily. In my simplified schema, tblHandler has a field for the AgencyID. Retrieve the Agency address in a query that links the two tables.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    goreyr is offline Novice
    Windows 8 Access 2013
    Join Date
    Aug 2015
    Posts
    10
    Okay, I think I'm starting to understand. So what about this:

    A handler can be related to many different agencies, but only one primary agency. If they do not have a separate work address from their primary agency, their work address should be that of their primary agency.

    With this in mind, is it possible to make a query to use the address of the handler's primary agency as the handler's work address unless it is overwritten by something else?

    Thanks for all of the help.

  9. #9
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    If you need to relate handlers to many different agencies, this complicates the structure. Probably means a third "junction" table for relating handlers and agencies. This junction table can have a yes/no field that identifies the 'primary' agency. This means no field in tblHandlers for AgencyID.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  10. #10
    goreyr is offline Novice
    Windows 8 Access 2013
    Join Date
    Aug 2015
    Posts
    10
    Yeah, unfortunately I will need to be able to have a many to many between handlers and agencies, and also one between dogs and handlers. This is what I've developed so far, haven't even tried to stick in addresses yet:

    Click image for larger version. 

Name:	Database Structure Ex.png 
Views:	29 
Size:	45.0 KB 
ID:	21706

  11. #11
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Here's a draft model you might consider.
    I don't know all of your detail requirements, but put this together based on the thread so far.
    Good luck.
    Attached Thumbnails Attached Thumbnails DogsHandlersAgencies.jpg  

  12. #12
    goreyr is offline Novice
    Windows 8 Access 2013
    Join Date
    Aug 2015
    Posts
    10
    Thanks, orange!

    What are the benefits to having the additional triple junction there?

  13. #13
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    It's a compound key because you said handlers and agencies have many-to-many relationship - a handler can associate with more than one agency.

    A variation to avoid compound key could be

    tblHandlerAgency
    HandAgID
    AgencyID
    HandlerID

    tblDogAndHandAg
    DogID
    HandAgID
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  14. #14
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    I really don't know your requirements.
    That junction relates
    - Dog and Handler and Agency

    Your bottom line seemed to deal with this combination - to me.
    If this kind of query is not important or needed, you could ignore that junction.

    Which Handler handled DogX through AgencyW?

    What Agency did Handler R use when handling MyLittleMonster?

    If you have a series of queries or reports etc that you need to have answers to, test them against the model. If the junction isn't needed, drop it.

    Also, note ( I just saw June's post re compound keys)

    In the junction tables I defaulted to compound primary keys. You'll notice, when you make a junction of junctions you add additional fields to the resultant junction (compound) primary key.

    An alternative to compound keys in junctions is:

    Create a unique primary key (autonumber) for the junction, then
    create a unique composite index of the individual primary keys of those tables involved in the many to many. The primary key will handle the requirements of the database. The unique composite index will prevent duplicates.

  15. #15
    goreyr is offline Novice
    Windows 8 Access 2013
    Join Date
    Aug 2015
    Posts
    10
    Sorry for all the questions, but why do you keep the many to many relationship between dogs and handlers and the many to many between handlers and agencies if I have the triple junction between all three? Am I able to do more by having both the triple junction and the two many to many relationships?

    EDIT:

    Are the individual many to many relationships the places that let me designate primary handlers between handlers and dogs, and primary agencies for handlers?
    Last edited by goreyr; 08-18-2015 at 04:20 PM. Reason: Clarifying my quesiton

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 01-09-2017, 07:20 AM
  2. Replies: 8
    Last Post: 05-31-2013, 05:20 PM
  3. Replies: 8
    Last Post: 02-27-2013, 04:56 PM
  4. Replies: 10
    Last Post: 11-04-2012, 07:18 AM
  5. Poor performance in design mode after split
    By sprovoyeur in forum Access
    Replies: 1
    Last Post: 04-13-2010, 03:25 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums