Whenever you want to view any information about an order's customer, you use the relationship to identify which data from the Customers table corresponds to which records in the Orders table.Ī foreign key — note the absence of the key icon. When you add a record to the Orders table, you use a value for customer ID that comes from the Customers table. To associate each order with a customer, you add a foreign key field to the Orders table that corresponds to the ID field of the Customers table, and then create a relationship between the two keys. In your Customers table, each record is identified by the primary key field, ID. For example, suppose that you have a Customers table and an Orders table. You use a table relationship to combine data from related tables. The correspondence of values between key fields forms the basis of a table relationship. The customer ID field is a foreign key of the Orders table. For example, you might have an Orders table in which each order has a customer ID number that corresponds to a record in a Customers table. A foreign key contains values that correspond to values in the primary key of another table.
#MS ACCESS DATA TYPES SERIAL#
Often, there is a unique identification number, such as an ID number, a serial number, or a code, that serves as a primary key. A primary key consists of one or more fields that uniquely identify each record that you store in the table. Primary key A table can have only one primary key.A key usually consists of one field, but may consist of more than one field. Keysįields that are part of a table relationship are called keys. A relationship is a logical connection between two tables that specifies fields that the tables have in common. To connect the data stored in different tables, you create relationships. An orders table that tracks customer orders.īecause you store data about different subjects in separate tables, you need some way to tie the data together so that you can easily combine related data from those separate tables.
Note You can create a new field in Access by entering data in a new column in Datasheet view.