Results 1 to 4 of 4
  1. #1
    dsaxena15 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2012
    Posts
    18

    Referential integrity constraint

    Hey guys,

    I'm new at MS-Access. I don't clearly understand what "referential integrity constraint" means. I looked up online but all I get is fancy definitions which don't make sense.

    Also, if someone could explain to me what is "cascade update related fields" and "cascade delete related records".


    I get these three options when I try to create a relationship between 2 tables. Thanks a lot!

  2. #2
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi - I'll give it shot.

    "Referential integrity" means that the data in the tables must conform to the relationships which have been defined. This is best illustrated by an example. Let's take the common one of customers and orders. You would have a customers table, and an orders table, and let's assume a relationship has been defined between the two using the Customer_ID. The relationship between Customers and Orders is one-to-many, i.e. one customer can have many orders. The customers each have a unique ID, and when entering a new order, you would indicate which customer the order was for by entering the Customer ID on the order form.

    The concept of referential integrity means that (in this case) for an order to be valid, it a) must have a Customer ID entered, and b) the Customer ID must exist in the Customer table; in other words, a record in the Orders table cannot exist without a corresponding record in the Customers table. (However, this does not prevent there being Customers who do not have any orders yet.) Maintaining Referential integrity also means that a Customer record cannot be deleted if there are any corresponding records for that customer in the Orders table, because we just said that Orders must have corresponding Customers. But this all leads to your next question...

    Cascade update related fields means that for example if you change a Customer's ID number, the ID number change will also be made on all orders for that customer. If when you define the relationship, you do not allow cascade updates, then you would not be able to change a Customer_ID, because that would result in orders with no corresponding customer.

    Cascade delete related records means that deleting a record on the "one" side of a one-to-many relationship will also delete all related records on the "many" side. In other words, when Cascade Delete is allowed, deleting a customer will also delete all orders for that customer. You have to be absolutely sure of what you are doing before enabling cascade delete, especially when data on the "many" side is of historical or financial significance.

    My own opinion is that whenever possible you should enforce referential integrity in your relationships - it prevents all sorts of errors from being made. Use the cascade update/delete only when you know what the effects will be.

    HTH

    John

  3. #3
    tanvi is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    100
    Referential integrity is a system of rules that Microsoft Access uses to ensure that relationship data is valid and that you cannot accidentally delete a record in one table if a matching record is present in a related table. For detail information please visit this link: http://www.ehow.com/how_13625_unders...integrity.html

    Cascading updates or cascading deletes are used to overrule referential integrity rules while retaining relationship integrity. These conditions only apply to relationships in which referential integrity is enforced.

  4. #4
    dsaxena15 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2012
    Posts
    18
    You guys are awesome! Thanks a lot! I really appreciate the help! Thanks again!

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

Similar Threads

  1. Referential Integrity
    By Paul H in forum Database Design
    Replies: 3
    Last Post: 11-14-2011, 03:07 PM
  2. referential integrity
    By askjacq in forum Database Design
    Replies: 1
    Last Post: 10-14-2011, 03:23 PM
  3. Referential Integrity
    By Desstro in forum Database Design
    Replies: 4
    Last Post: 06-13-2010, 01:29 PM
  4. Referential Integrity
    By U810190 in forum Access
    Replies: 1
    Last Post: 03-29-2010, 05:21 PM
  5. Referential Integrity
    By jbarrum in forum Access
    Replies: 5
    Last Post: 01-14-2010, 09:04 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