Вы находитесь на странице: 1из 3

Create table relationships

What are relationships? Relationships are links that associate a field in one table with a field in another. An example is a school database with two tables: Students Classes The Students table holds students names and addresses:
Students Student Name Address John Elm St. Jane Oak St.

The Math Class table holds information about the students in math class:
Math Class Student Name Grade John A Jane B

Both tables have a Student Name field. By linking the Student Name fields, you make sure that John in the Students table is the same John listed in the Math Class table:
Students Math Class Student Name Address Student Name Grade John John Jane Jane 120 WORKING WITH TABLES

Examine current table relationships 1. On the Toolbar, click the icon. 2. On the Toolbar, click the icon. 3. When the Show Table window appears, double-click
Customers.
WORKING WITH TABLES 121

The Customers table should appear in the Relationships field:

4. 5. 6. 7. 8.

In the Show Table window, double-click Employees. The Employees table should appear in the Relationships field: Double-click Order Details. Double-click Orders.
WORKING WITH TABLES

122

Double-click Products.

In the Show Tables window, click the button. The relationships window should now look like this:
WORKING WITH TABLES 123

Add relationships 1. Place the cursor on the Title Bar at the top of the
Employees table.

2.

Click and drag the Employees table to place it under

the Customers table.


124
WORKING WITH TABLES

3. 4.

Click and drag the Orders table to place it between

the Customers table and Order Details table. Click the Order ID field in the Order Details table, then drag it and rest it on top of the Order ID field in the Orders table. The Orders table should look like this:
WORKING WITH TABLES 125

5.

Release the mouse button. When the Edit Relationships window appears, click the button. The relationships window should now look like this:

The Order ID field in the Orders table is linked to the Order ID field in the Order Details table. The same Order ID number in both tables refers to the same order.
126
WORKING WITH TABLES

6. 7. 8.

On the Menu Bar, click File, then Close to return to the FoodStore1 database window. When the alert window appears, click the button. On the Menu Bar, click File, then Exit.

WORKING WITH TABLES 127

Вам также может понравиться