- Why This Chapter Is Important
- Introduction to Relational Database Design
- Establishing Relationships in Access
- Establishing Referential Integrity
- Looking at the Benefits of Relationships
- Examining Indexes and Relationships
- Summary
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 referential integrity is established, 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. Most 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.
NOTE
SQL Server 2000 offers Cascade Update and Cascade Delete features similar to those found in Microsoft Access. This means that you no longer need to write your own T-SQL statements when it is appropriate to implement Cascade Update and Delete functionality.
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 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.