Professional Documents
Culture Documents
Table Relationship
Table Relationship
http://etutorials.org/SQL/Database+design+for+mere+mortals/
Part+II+The+Design+Process/
Chapter+10.+Table+Relationships/Types+of+Relationships/
A relationship in Access helps you combine data from two different
tables.
Each relationship consists of fields in two tables with corresponding
data. For example, you might have a ProductID field in a Products table
and in an OrderDetails table.
HOW TO CREATE TABLE
RELATIONSHIP
The relationship map lists all of the tables that were selected to relate, as well as all of the
fields that were previously set up for that table. Notice that the first field has a key icon next
to it. This is the primary key for the table.
WHAT IS A PRIMARY KEY
A primary key is the first field in each table of the database.
This field auto-numbers by default, so every record in the table has its own unique number
to identify it. Access uses this number to quickly pull information together when you run
queries or reports.
For example above, the primary key for the Customers table is Customer ID, the primary
key for the Orders table is Order ID, and the primary key for the Books table is Book ID.
UNDERSTANDING THE RELATIONSHIP MAP
A foreign key is a field that is the primary field in its own table but that shows up in another
table. If you look closely at the Orders table, the fields Customer ID and Book ID appear
there, as well as in their own respective tables. These fields are the primary key in their own
tables, but in the Orders table, they are considered foreign keys.
TYPES OF RELATIONSHIPS
One to One -A pair of tables bears a one-to-one relationship when a single record in the first
table is related to only one record in the second table, and a single record in the second table is
related to only one record in the first table.
TYPES OF RELATIONSHIPS
One to One -A pair of tables bears a one-to-one relationship when a single record in the first
table is related to only one record in the second table, and a single record in the second table is
related to only one record in the first table.
One-to-Many Relationships - A one-to-many relationship exists between a pair of tables when
a single record in the first table can be related to one or more records in the second table, but a
single record in the second table can be related to only one record in the first table.
Many-to-Many Relationships - A pair of tables bears a many-to-many relationship when a
single record in the first table can be related to one or more records in the second table and a
single record in the second table can be related to one or more records in the first table.