Create relationships

Primary and foreign keys in a table structure

Let's do a quick review. The first course in this series showed you how to divide your data into separate tables and identify the relationships between those tables. In the second course, you built your tables and gave each one a primary key – a field with a value that makes each row unique. Now it's time to link your tables by creating relationships.

In a database, relationships are critical because they’re how your tables "talk" to each other. If your tables don't talk, you can't get answers from your data, and you’ll see how that works in the next course. You create relationships by using a field from one table as a field in a related table.

The field you include is your primary key. As you saw in the last lesson, each of the tables in your database has a primary key, and you include it as a new field in another table to create a relationship with that other table.

When you share a primary key, the new field in the second table is called a foreign key.

The picture illustrates one way this can work. In order to associate assets with suppliers, the foreign key field in the Assets table provides a list of company names. Behind the scenes, Access uses the values in the primary and foreign keys to synchronize the two fields. In turn, you can use that relationship to answer questions such as, "Which company provided a given computer?"

This lesson and the practice at the end of this course show you how to create that type of relationship and how to set rules that control how you can update and delete the data in your database.

Expand your Office skills
Explore training
Get new features first
Join Office Insiders

Was this information helpful?

Thank you for your feedback!

Thank you for your feedback! It sounds like it might be helpful to connect you to one of our Office support agents.