Establishing Referential Integrity

As you can see, establishing a relationship is quite easy. Establishing the right kind of relationship is a little more difficult. When you attempt to establish a relationship between two tables, SQL Server makes some decisions based on a few predefined factors:

  • A one-to-many relationship is established if one of the related fields is a primary key or has a unique index.

  • A one-to-one relationship is established if both the related fields are primary keys or have unique indexes.

  • A relationship cannot be created if neither of the related fields is a primary key and neither has a unique index.

As covered earlier in this chapter, referential integrity consists of a series of rules that SQL Server applies to ensure ...

Get Alison Balter's Mastering Access 2002 Enterprise Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.