Results 1 to 5 of 5
  1. #1
    ByronSmith3 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Sep 2014
    Posts
    3

    Help with a One to Many relationship

    Hello all! New here, self-learning database design and applying what I learn with Access. I believe I have a good understanding of Relationships, however, I am having problems with a one to many relationship I created. I have a table, named 'Names_Info' (the child) and another named 'Business_Info' (the parent). Names_Info has a foreign key labeled 'Business_ID' and is linked to the primary key of the parent table. If I attempt to create a record in the 'Names_Info' table, which is the parent table to a few other tables, it won't let me create the record if the record is not associated with a business record. I can understand why this is, but in a real database solution situation, the name record might not have a business association if, say, the person was unemployed. I have read that the FK may be or may not be Null (and I have it as not required in the 'Names_Info ' table), so how do I do this? I know if I create a many to many relationship I can solve this, but I'm trying to learn without creating that type of relationship. Thanks!

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    If Names_Info is the child of Business_Info, and there is no Business_Info record for that child, it seems you have an illogical set up.

    Consider Parent and Child in the traditional family set up. You can't really have a Child without a Parent---which is the situation you described.
    Perhaps you could tell us more of your situation.

  3. #3
    ByronSmith3 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Sep 2014
    Posts
    3
    The parent / child relationship you described is the part that I understand as to why I am having the issue, but I thought that I have read somewhere that a foreign key in a one to many relationship may be null, and may not be null. To describe what I am doing: I am building a Customer Relationship Management tool as a learning tool for myself as I learn database design, SQL, etc. I have designed the database using an ERD, and now I am trying to put it to use. In this database, Names of people could be customers (stored in the 'Names_Info' table, and businesses could be customers (stored in the 'Business_Info' table). However, Names can also work for a business, be a contact or decision maker of the business, etc. In my design, a business can be related to many names, but each name record in the 'Names_Info' table can only be related to one business. But what if a name who is a potential customer is unemployed, a homemaker, or I don't have the name of the business that they work for information? As stated above, if I keep this field blank, I cannot create the record in the 'Names_Info' table. I could create a record in the 'Business_Info' table that states 'Unknown' and/or 'Unemployed', etc., but I believe that this will give me problems in the future. 'Names_Info' primary key is 'Names_ID', and the 'Business_Info' table uses 'Business_ID' as its primary key. 'Business_ID' is the foreign key in the 'Names_Info' table. I hope that this is enough information.

  4. #4
    ByronSmith3 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Sep 2014
    Posts
    3
    I think I might have figured it out. If I remove referential integrity in this relationship, I should be able to create the name record without the business record. But I should sit down and review my design before doing this to ensure it won't create any issues later on. Does that sound correct, though?

  5. #5
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    Please post a copy of your ERD. It's good that you have an example and are working to learn by doing.

    I don't understand the "business" at this point. You mention Customers but haven't mentioned a customer table. Names don't work in a Business -- I think it would be People or Person. I don't know how you have determined a sort of leveling --I'm not following unemployed and homemaker
    in the same theme?? Customer vs potential Customer..

    You may get some ideas here.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. One-to-less-than-one relationship
    By neo651 in forum Database Design
    Replies: 5
    Last Post: 08-06-2012, 10:09 PM
  2. One to Many relationship
    By ramindya in forum Access
    Replies: 4
    Last Post: 02-10-2012, 01:59 PM
  3. Relationship 1:1
    By MrLestat in forum Database Design
    Replies: 1
    Last Post: 05-18-2011, 07:13 AM
  4. many-to-one relationship
    By reverze in forum Access
    Replies: 7
    Last Post: 07-14-2010, 10:03 AM
  5. MAY TO MANY RELATIONSHIP
    By fadone in forum Database Design
    Replies: 2
    Last Post: 12-20-2005, 09:03 AM

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