Chapter 7: Working with Data | 189 |
Figure 7-7 Configuring a foreign key relationship
In the primary key table
automatically selects the primary key, CustomerID. (Note: If you don’t see this behavior, check to see that you’ve set your primary key columns and saved those table changes as described earlier.) In the list, under Foreign Key Table in Figure
Once the foreign key is in place, you can add a few records to the Order table, much as you did with the Customer table, but remember that the CustomerID must match
an existing CustomerID in the Customer table because of the foreign key relationship. Forcing the child to refer to its parent is good because it maintains the integrity of the database, demonstrating the value of a foreign key.