• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 5. SQL Server Tables and Databas... > Looking at the Benefits of Relations...

Looking at the Benefits of Relationships

The primary benefit of relationships is the data integrity they provide. Without the establishment of relationships, users are free to add records to child tables without regard to entering required parent information. After you establish referential integrity, you can enable Cascade Update Related Fields or Cascade Delete Related Records, as appropriate, which will save you quite a bit of code in maintaining the integrity of the data in your system. Many relational database-management systems require that you write the code to delete related records when a parent record is deleted or to update the foreign key in related records when the primary key of the parent is modified. By enabling the Cascade Update and Cascade Delete check boxes, you are sheltered from having to write a single line of code to perform these tasks when they are appropriate.

Relationships automatically are carried into your queries. This means that each time you build a new query, the relationships between the tables within it automatically are established, based on the relationships that you have set up in the Relationships window. Furthermore, each time you build a form or report, relationships between the tables included on the form or report are used to assist with the design process. Whether you delete or update data using a datasheet or a form, all referential integrity rules automatically apply, even if the relationship is established after the form is built.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint