Creating Relationships between Tables
Microsoft Access is a relational database application. Its key
characteristic is that all tables in a database are related to
each other. Suppose we have more than one table in our database.
How do we make a relationship between them?
In the database view, press the right click button of your mouse.
A box similar to the image below will appear. Notice the highlighted
part, Relationships. **redo the image below and use the button
on the toolbar for relationships, as previously discussed**
After clicking on Relationships, a box listing all of your tables
will appear. You can select the tables that you want to make a
relationship for by holding the Ctrl button and left clicking on
the items, or by holding the Shift button and highlighting with
your arrow keys. Or you may simply left click and hold, if the
tables that you are going to choose are adjacent in the list. Once
you finish selecting tables, click on Add, and then Close.
You may now view the Relationships screen with the two tables
displayed.
To connect the Employee Attendance table with the Employees Information
table to form a relationship, click on the Emp_IDNumber field in
the Employee Attendance table and drag it over on top of the Emp_IDNumber
field on the Employee Attendance table. Release the mouse button,
and the Edit Relationships dialog box will appear as shown in the
image below. With it, you can choose the Relationship Type (almost
always One-to-Many). Click on Join Type if you want to modify the
relationship between the tables. It is also advisable to uncheck
Enforce Referential Integrity because it applies constraints on
your record. When finished, click on Create.
The Relationships window will be displayed with the new relationship
in place.
|